A
A
alex stephen2016-10-28 16:14:35
Debian
alex stephen, 2016-10-28 16:14:35

Why can't /bin/bash be run in docker?

Dockerfile is something like this (removed irrelevant data):

FROM debian:8.4
ENV DEBIAN_FRONTEND noninteractive
ENTRYPOINT ['/bin/bash' '-c']

Assembles normally. But at startup it gives out:
/bin/sh: 1: [/bin/bash: not found
Tried: change to /bin/sh, ENTRYPOINT to CMD, and many more different options ...
At the same time, docker run 'vendor/container' /bin/bash works fine.
CHADNT?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shaqster, 2016-10-28
@shaqster

The way I solved this problem for myself. Does not claim to be correct. You need to copy the .sh file to the container and specify it as executable when the container starts.
Dockerfile:

COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod 0755 /usr/local/bin/docker-entrypoint.sh
CMD ["/usr/local/bin/docker-entrypoint.sh"]

docker-entrypoint.sh
Now when you docker attach container_name you will get the bash of the container

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question