I am having a very weird issue to where my docker container tells me it’s unable to execute a file because it can’t find it; however, I restructured my
Dockerfile so that it’s running an ls in that directory to find the file. Based on the output during the docker build, the file actually exists, so I can’t quite understand why it’s not able to run it on the very next line.
Here’s a snippet from my Dockerfile:
# Replace systemctl with a working one git clone https://github.com/gdraheim/docker-systemctl-replacement /opt/systemctl-github && \ rm /usr/bin/systemctl && \ ln -s /opt/systemctl-github/files/docker/systemctl.py /usr/bin/systemctl && \ dpkg -i /tmp/ssm/amazon-ssm-agent.deb && \ ls -lh /usr/bin/systemctl && \ systemctl stop amazon-ssm-agent && \
However, when building the container, I see the following error:
Cloning into '/opt/systemctl-github'... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 30.7M 100 30.7M 0 0 14.5M 0 0:00:02 0:00:02 --:--:-- 14.5M lrwxrwxrwx 1 root root 47 Dec 14 22:20 /usr/bin/systemctl -> /opt/systemctl-github/files/docker/systemctl.py /bin/sh: 1: /opt/systemctl-github/files/docker/systemctl.py: not found
Can’t seem to figure out any reason as to why this wouldn’t work.