Cannot override command using CMD or entry point


Jim

I am executing the following command from postgres doc

docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres

Now out of curiosity, I run the following commands:

docker run -it --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres bash

And I don't end up with an interactive bash shell.
Also trying:

docker run -it --name some-postgres --entrypoint bash -e POSTGRES_PASSWORD=mysecretpassword -d postgres

doesn't work either.

Why can't I override the default command?

Paul

The command works fine, but since you are using the -dflag, the container is starting in the background. Remove that flag and you'll enter an interactive bash session:

docker run -it --name some-postgres --entrypoint bash -e POSTGRES_PASSWORD=mysecretpassword postgres

Related


How to override CMD command in docker run line

Hedev How to replace CDM according to Docker documentation : https://docs.docker.com/reference/builder/#cmd You can override the CMD command Dockerfile: RUN chmod +x /srv/www/bin/* & chmod -R 755 /srv/www/app RUN pip3 install -r /srv/www/app/pip-requirements.t

cmd cannot find mvn command

Marcel M. I just installed Maven and added the maven \bindirectory to my path variable. When I try to use the command mvnin command prompt , I only get a message: mvn: command not found All the other info I found here didn't help. edit: I use https://maven.apa

Docker entry point and cmd together

old I try to set both the entry point and cmd's Docker. FROM debian:stretch RUN apt-get update && \ apt install gnupg ca-certificates -y RUN echo "deb http://repo.aptly.info/ squeeze main" > /etc/apt/sources.list.d/aptly.list RUN apt-key adv --keyserver keys.

docker: do not override base image entry point

Flying Well I want a docker image that can extend the mongo image and have ssh on it. I wrote this line: FROM mongo RUN apt-get update && \ apt-get install -y openssh-server EXPOSE 22 RUN useradd -s /bin/bash -p $(openssl passwd -1 test) -d /home/nf2/ -

How to override CMD command in docker run line

Hedev How to replace CDM according to Docker documentation : https://docs.docker.com/reference/builder/#cmd You can override the CMD command Dockerfile: RUN chmod +x /srv/www/bin/* & chmod -R 755 /srv/www/app RUN pip3 install -r /srv/www/app/pip-requirements.t

cmd cannot find mvn command

Marcel M. I just installed Maven and added the maven \bindirectory to my path variable. When I try to use the command mvnin command prompt , I only get a message: mvn: command not found All the other info I found here didn't help. edit: I use https://maven.apa

Docker entry point and cmd together

old I try to set both the entry point and cmd's Docker. FROM debian:stretch RUN apt-get update && \ apt install gnupg ca-certificates -y RUN echo "deb http://repo.aptly.info/ squeeze main" > /etc/apt/sources.list.d/aptly.list RUN apt-key adv --keyserver keys.

Using variables in cmd command

Green vegetables I'm trying to make a batch program that takes variables from basic CMD commands. E.g: c:\Users> ipconfig ..... IPv4 Address ....... 123.456.7.89 ..... Suppose I want to make a batch program that just prints the IP address on the screen like:

Using cProfile on an application with an entry point

Fox Parr I know cProfile can be used like this python -m cProfile script.py However, let's say I have a packaged application (pip installable) that is defined entry_pointin setup.py so I can call the application from the terminal without explicitly using any

Override Webpack 4 entry point

Samson Here is my project directory: -node_modules -src -client -js -styles -views -index.js -webpack.config.js -server -.babelrc -package -package-lock -README.md -webpack.de

Dockerfile CMD cannot locate entry point file

Immortality skills I have a COPY ./entrypoint.sh /usr/local/bin RUN chmod +x /usr/local/bin/entrypoint.sh CMD /usr/local/bin/entrypoint.sh But after building the image, when I try to run it, I get /bin/sh: /usr/local/bin/entrypoint.sh: not found If I change

The command /bin/bash does not override the default entry point

Packamore I'm trying to override the entry point of a custom image in order to call the binary. But the following command fails: docker run -it --entrypoint "/bin/bash -c" my-image:latest cat /etc/os-release docker: Error response from daemon: OCI runtime crea

Using variables in cmd command

Green vegetables I'm trying to make a batch program that takes variables from basic CMD commands. E.g: c:\Users> ipconfig ..... IPv4 Address ....... 123.456.7.89 ..... Suppose I want to make a batch program that just prints the IP address on the screen like:

docker: do not override base image entry point

Flying Well I want a docker image that can extend the mongo image and have ssh on it. I wrote this line: FROM mongo RUN apt-get update && \ apt-get install -y openssh-server EXPOSE 22 RUN useradd -s /bin/bash -p $(openssl passwd -1 test) -d /home/nf2/ -

docker: do not override base image entry point

Flying Well I want a docker image that can extend the mongo image and have ssh on it. I wrote this line: FROM mongo RUN apt-get update && \ apt-get install -y openssh-server EXPOSE 22 RUN useradd -s /bin/bash -p $(openssl passwd -1 test) -d /home/nf2/ -

How to override CMD command in docker run line

Hedev How to replace CDM according to Docker documentation : https://docs.docker.com/reference/builder/#cmd You can override the CMD command Dockerfile: RUN chmod +x /srv/www/bin/* & chmod -R 755 /srv/www/app RUN pip3 install -r /srv/www/app/pip-requirements.t

cmd cannot find mvn command

Marcel M. I just installed Maven and added the maven \bindirectory to my path variable. When I try to use the command mvnin command prompt , I only get a message: mvn: command not found All the other info I found here didn't help. edit: I use https://maven.apa

cmd cannot find mvn command

Marcel M. I just installed Maven and added the maven \bindirectory to my path variable. When I try to use the command mvnin command prompt , I only get a message: mvn: command not found All the other info I found here didn't help. edit: I use https://maven.apa

Docker entry point and cmd together

old I try to set both the entry point and cmd's Docker. FROM debian:stretch RUN apt-get update && \ apt install gnupg ca-certificates -y RUN echo "deb http://repo.aptly.info/ squeeze main" > /etc/apt/sources.list.d/aptly.list RUN apt-key adv --keyserver keys.

Using cProfile on an application with an entry point

Fox Parr I know cProfile can be used like this python -m cProfile script.py However, let's say I have a packaged application (pip installable) that is defined entry_pointin setup.py , so I can call the application from the terminal without explicitly using an

docker: do not override base image entry point

Flying Well I want a docker image that can extend the mongo image and have ssh on it. I wrote this line: FROM mongo RUN apt-get update && \ apt-get install -y openssh-server EXPOSE 22 RUN useradd -s /bin/bash -p $(openssl passwd -1 test) -d /home/nf2/ -

docker: do not override base image entry point

Flying Well I want a docker image that can extend the mongo image and have ssh on it. I wrote this line: FROM mongo RUN apt-get update && \ apt-get install -y openssh-server EXPOSE 22 RUN useradd -s /bin/bash -p $(openssl passwd -1 test) -d /home/nf2/ -