docker-compose

Is there any way to disable a service in docker-compose.yml

人盡茶涼 提交于 2019-12-20 10:15:20
问题 I find myself in the situation, that I want to disable a service temporarily in a docker-compose file. Of course I could comment it out, but is there any option to just say " enabled: false " ? 回答1: You could simply redefine the entrypoint or command in order to replace said command with something which does nothing ( /bin/true ) That would make the container exit immediately, doing nothing. shadi adds the following tips in the comments: If you don't want the service to get built at all,

Difference between 'image' and 'build' within docker compose

心不动则不痛 提交于 2019-12-20 09:52:16
问题 Please help me understand the difference between 'image' and 'build' within docker compose 回答1: image means docker compose will run a container based on that image build means docker compose will first build an image based on the Dockerfile found in the path associated with build (and then run a container based on that image). PR 2458 was eventually merged to allow both (and use image as the image name when building, if it exists). therobyouknow mentions in the comments: dockerfile: as a sub

Why am I unable to run django migrations via the 'docker-compose run web' command?

帅比萌擦擦* 提交于 2019-12-20 09:39:50
问题 So I am deploying django, postgress and nginx containers via docker-compose and I have an issue that I can't seem to figure out. In order to resolve the following error in my Django app, I knew I just had to run a Django migration. docker@postgres ERROR: relation "accounts_myprofile" does not exist In an attempt to run migrations, I tried: docker-compose run web python manage.py makemigrations docker-compose run web python manage.py migrate which returned the following: Migrations for

Docker-compose environment variables

馋奶兔 提交于 2019-12-20 09:11:19
问题 I am trying to setup a postgres container and want to setup the postgres login with: POSTGRES_USER: docker POSTGRES_PASSWORD: docker So I have created the docker-compose.yml like so web: build: . ports: - "62576:62576" links: - redis - db db: image: postgres environment: POSTGRES_PASSWORD: docker POSTGRES_USER: docker redis: image: redis I have also tried the other syntax for environment variable declaring the db section as: db: image: postgres environment: - POSTGRES_PASSWORD=docker -

Docker-compose: deploying service in multiple hosts

我的未来我决定 提交于 2019-12-20 08:53:31
问题 I have a docker-compose file that deploys 8 different docker services in the same host. Is it possible to deploy it in different hosts?, I would like to deploy some service in one hosts and another ones in other host remotelly. Would I need to use docker-swarm? or is an easier way to do? I have read that it could be done using DOCKER_HOST, but if I configure /etc/default/docker with this variable, all the services would be run on the remote host, and what I need is some services in one remote

how to get docker-compose to use the latest image from repository

拥有回忆 提交于 2019-12-20 08:47:05
问题 I don't know what I'm doing wrong, but I simply cannot get docker-compose up to use the latest image from our registry without first removing the old containers from the system completely. It looks like compose is using the previously started image even though docker-compose pull has fetched a newer image. I looked at How to get docker-compose to always re-create containers from fresh images? which seemed to be similar to my issue, but none of the provided solutions there work for me, since I

What is the difference between `docker-compose build` and `docker build`?

南楼画角 提交于 2019-12-20 08:46:40
问题 What is the difference between docker-compose build and docker build ? Suppose in a dockerized project path there is a docker-compose.yml file: docker-compose build And docker build 回答1: docker-compose is a wrapper around the docker CLI in order to gain time and avoid 500 characters-long lines (and also start multiple containers at the same time). It uses a file called docker-compose.yml in order to retrieve parameters. You can find the reference for the docker-compose file format here. So

How to rebuild and update a container without downtime with docker-compose?

◇◆丶佛笑我妖孽 提交于 2019-12-20 08:46:24
问题 I enjoy a lot using docker-compose. Eg. on my server, when I want to update my app with minor changes, I only need to git pull origin master && docker-compose restart , works perfectly. But sometimes, I need to rebuild (eg. I added an npm dependency, need to run npm install again). In this case, I do docker-compose build --no-cache && docker-compose restart . I would expect this to : create a new instance of my container stop the existing container (after the newer has finished building)

How to rebuild and update a container without downtime with docker-compose?

混江龙づ霸主 提交于 2019-12-20 08:42:38
问题 I enjoy a lot using docker-compose. Eg. on my server, when I want to update my app with minor changes, I only need to git pull origin master && docker-compose restart , works perfectly. But sometimes, I need to rebuild (eg. I added an npm dependency, need to run npm install again). In this case, I do docker-compose build --no-cache && docker-compose restart . I would expect this to : create a new instance of my container stop the existing container (after the newer has finished building)

Docker Containers can not be stopped or removed - permission denied Error

。_饼干妹妹 提交于 2019-12-20 08:37:32
问题 Issue : Can not stop docker containers, whenever I try to stop containers I get the following Error message, ERROR: for yattyadocker_web_1 cannot stop container: 1f04148910c5bac38983e6beb3f6da4c8be3f46ceeccdc8d7de0da9d2d76edd8: Cannot kill container 1f04148910c5bac38983e6beb3f6da4c8be3f46ceeccdc8d7de0da9d2d76edd8: rpc error: code = PermissionDenied desc = permission denied OS Version/build: Ubuntu 16.04 | Docker Version 17.09.0-ce, build afdb6d4 | Docker Compose version 1.17.1, build 6d101fb