How to rebuild docker container in docker-compose.yml?

前端 未结 10 2041
闹比i
闹比i 2021-01-29 17:14

There are scope of services which defined in docker-compose.yml. These service have been started. I need to rebuild only one of these and start it without up other services. I r

10条回答
  •  庸人自扰
    2021-01-29 17:51

    The problem is:

    $ docker-compose stop nginx
    

    didn't work (you said it is still running). If you are going to rebuild it anyway, you can try killing it:

    $ docker-compose kill nginx
    

    If it still doesn't work, try to stop it with docker directly:

    $ docker stop nginx
    

    or delete it

    $ docker rm -f nginx
    

    If that still doesn't work, check your version of docker, you might want to upgrade.

    It might be a bug, you could check if one matches your system/version. Here are a couple, for ex: https://github.com/docker/docker/issues/10589

    https://github.com/docker/docker/issues/12738

    As a workaround, you could try to kill the process.

    $ ps aux | grep docker 
    $ kill 225654 # example process id
    

提交回复
热议问题