I created one image using below Dockerfile
FROM ubuntu:latest
RUN mkdir -p /app
COPY . /app
CMD python /app/app.py
I am using this command to build the image:
DOCKER_BUILDKIT=1 docker build -t my-first-ubuntu-image .
And this one to run the container
Command for running the container : docker container run -d my-first-ubuntu-image
And when I run docker ps -a*
, its status is showing Exited
.
What is going on? I cannot understand because when I did the same for a nginx
image, it is in running
state.
There is a trick to prevent the container from dying: docker run -d my_image -d tail /dev/null -f
The command tail /dev/null -f
keeps the container busy forever.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.