Search code examples
shelldockerdebiandockerfilehaproxy

Build failed while appending line in source of docker container


I'm working on https://github.com/audip/rpi-haproxy and get this error message when building the docker container:

Build failed: The command '/bin/sh -c echo "deb http://httpredir.debian.org/debian jessie-backports main" >> /etc/apt/sources.list' returned a non-zero code: 1

This can be viewed at https://hub.docker.com/r/audip/rpi-haproxy/builds/brxdkayq3g45jjhppndcwnb/

I tried to find answers, but the problem seems to be something off on Line 4 of the Dockerfile. Need help to fix this build from failing.

# Pull base image.
FROM resin/rpi-raspbian:latest

# Enable Jessie backports
RUN echo "deb http://httpredir.debian.org/debian jessie-backports main" >> /etc/apt/sources.list

# Setup GPG keys
RUN gpg --keyserver pgpkeys.mit.edu --recv-key  8B48AD6246925553 \     
    && gpg -a --export 8B48AD6246925553 | sudo apt-key add - \
    && gpg --keyserver pgpkeys.mit.edu --recv-key  7638D0442B90D010 \  
    && gpg -a --export 7638D0442B90D010 | sudo apt-key add -

# Install HAProxy      
RUN apt-get update \
    && apt-get install haproxy -t jessie-backports

# Define working directory.
WORKDIR /usr/local/etc/haproxy/

# Copy config file to container
COPY haproxy.cfg .
COPY start.bash .

# Define mountable directories.
VOLUME ["/haproxy-override"]

# Run loadbalancer
# CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"]

# Define default command.
CMD ["bash", "start.bash"]

# Expose ports.
EXPOSE 80
EXPOSE 443

Solution

  • From your logs:

    standard_init_linux.go:178: exec user process caused "exec format error"
    

    It's complaining about an invalid binary format. The image you are using is a Raspberry Pi image, which would be based on an ARM chipset. Your build is running on an AMD64 chipset. These are not binary compatible. I believe this image is designed to be built on a Pi itself.