Intentionally removing volumes in override docker-compose files

I’m assuming you want to use docker-compose up to start the development version, and have a second config file to extend it for production. If you want to make sure to override volumes completely, use a third config file, docker-compose.override.yml. Put all your volume definitions for development in there. docker-compose up extends the base config … Read more

How do I specify nvidia runtime from docker-compose.yml?

Currently (Aug 2018), NVIDIA container runtime for Docker (nvidia-docker2) supports Docker Compose. Yes, use Compose format 2.3 and add runtime: nvidia to your GPU service. Docker Compose must be version 1.19.0 or higher. Example docker-compose.yml: version: ‘2.3’ services: nvsmi: image: ubuntu:16.04 runtime: nvidia environment: – NVIDIA_VISIBLE_DEVICES=all command: nvidia-smi More example from NVIDIA blog uses Docker … Read more

Update only one Container via docker-compose

Just run docker-compose up -d again (without down / stop / kill before). Initial docker-compose.yml: version: “2” services: db1: command: mongod image: mongo:3.2.4 ports: – “27020:27017” db2: command: mongod image: mongo:3.2.4 ports: – “27021:27017” Update db2: version: “2” services: db1: command: mongod image: mongo:3.2.4 ports: – “27020:27017” db2: command: mongod image: mongo:3.2.6 ports: – “27021:27017” … Read more

Error 99 connecting to localhost:6379. Cannot assign requested address

In the flask app I have a function that tries to create a redis client db = redis.Redis(host=”localhost”, port=6379, decode_responses=True) When your flask process runs in a container, localhost refers to the network interface of the container itself. It does not resolve to the network interface of your docker host. So you need to replace … Read more

docker stack deploy results in “No such image error”

Already found the solution. My image is hosted on a private repository. Besides the swarm manager (where I executed the commands), I had a running swarm worker. When I ran docker stack deploy -c docker-compose.yml myapp docker deployed the service to the worker node (not the manager node as I thought). At the worker node, … Read more