简体   繁体   中英

On OS (CoreOS) restart Docker starts multiple containers

I have my customer Docker container on a CoreOS OS host. I start my container using the docker run command as. follows:

docker run -d --restart always --net=host -p 8080:8080 --log-opt max-size=2mb my_docker_hub_accountname/imagename

And when I reboot the host I always see multiple images being run when I run the following command:

user@coreos-1 ~ $ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                  PORTS               NAMES
4ac46db4a58c        3fa7e73d544d        "java -jar /code/kec…"   7 days ago          Up Less than a second                       lucid_aryabhata

da5392c136e9        7d996239c21c        "java -jar /code/kec…"   7 days ago          Up Less than a second                       awesome_jackson

15bcc4cfe26b        7d996239c21c        "java -jar /code/kec…"   4 weeks ago         Up Less than a second                       fervent_colden

f050f55bea3c        7d996239c21c        "java -jar /code/kec…"   4 weeks ago         Up Less than a second                       condescending_poincare

31e00707ddff        7d996239c21c        "java -jar /code/kec…"   4 months ago        Up Less than a second                       awesome_curran

user@coreos-1 ~

Is there a way to control so that I only have 1 image running instead of multiple images by the Docker container?

I was able to resolve this in one way.

I searched for all container using command:

docker ps -a

I had to remove all the other containers that were previously run using

docker rm $container_id

Now I only 1 docker image running in a container. I reboot and I only see 1 container running.

hope it helps another docker user.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM