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

前端 未结 10 2035
闹比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:47

    As @HarlemSquirrel posted, it is the best and I think the correct solution.

    But, to answer the OP specific problem, it should be something like the following command, as he doesn't want to recreate ALL services in the docker-compose.yml file, but only the nginx one:

    docker-compose up -d --force-recreate --no-deps --build nginx
    

    Options description:

    Options:
      -d                  Detached mode: Run containers in the background,
                          print new container names. Incompatible with
                          --abort-on-container-exit.
      --force-recreate    Recreate containers even if their configuration
                          and image haven't changed.
      --build             Build images before starting containers.
      --no-deps           Don't start linked services.
    

提交回复
热议问题