Specify the env file docker compose uses

You can use inheritance for this. If you have one “base” service where you set up the environment, all of your other services can inherit from that. Example: version: “2” services: base: env_file: – my_env.txt web: extends: service: base image: foo database: extends: service: base image: foo-db The above example has everything in the same … Read more

docker-compose: how to see file-changes instantly (when developing)

The idea of “Development/Production parity” confuses many on this front. This doesn’t mean that you can simply have a single configuration and it will work across everything; it means you’ll have much closer parity and that you can create an environment that resembles something very close to what you’ll have in production. What’s wrong here … Read more

Rails app in docker container doesn’t reload in development

I was struggling with this as well, there are 2 things that you need to do: Map the current directory to the place where Docker is currently hosting the files. Change the config.file_watcher to ActiveSupport::FileUpdateChecker Step 1: In your Dockerfile, check where are you copying/adding the files. See my Dockerfile: # https://docs.docker.com/compose/rails/#define-the-project FROM ruby:2.5.0 # … Read more

Docker compose & docker-entrypoint

\”./docker-entrypoint.sh\”: permission denied”: unknown I would guess your docker-entrypoint.sh doesn’t have execute permissions (x). But also docker-compose.yml is not really the best place for the docker-entrypoint.sh. It’s the override setting, see entrypoint. The default should go in the Dockerfile. Try this: Add this to the end of your Dockerfile COPY ./docker-entrypoint.sh /docker-entrypoint.sh RUN chmod +x … Read more

specify sysctl values using docker-compose

This option is now available in docker-compose 1.10.0-rc1, you’ll need to upgrade to that version (pip install docker-compose==1.10.0-rc1) and also update your docker-compose.yml file to version 2.1 per docs Example docker-compose.yml: version: ‘2.1’ services: app: build: . sysctls: – net.ipv6.conf.all.disable_ipv6=1

how to link docker container to each other with docker-compose

Updated for Docker 1.10 Docker 1.10 allows the definition of networks within the compose file. Here’s the updated code version: “2” services: replica1: image: mongo:2.6.8 container_name: replica1 networks: – my-net ports: – “27018” environment: REPLICA2_URL: “http://replica2:27019” replica2: image: mongo:2.6.8 container_name: replica2 networks: – my-net ports: – “27019” environment: REPLICA1_URL: “http://replica1:27018” networks: my-net: driver: bridge Previous … Read more

docker-compose adding to PATH

A docker-compose.yml does not offer you any mean to extend an environment variable which would already be set in a Docker image. The only way I see to do such things is to have a Docker image which expects some environment variable (let’s say ADDITONAL_PATH) and extends at run time its own PATH environment variable … Read more

HEALTHCHECK: Dockerfile vs docker-compose.yml

Adding health check to the Dockerfile, will make the health-check part of the image, so that anyone pulling the image from the registry will get the health check by default. Compose files are usually less shared than the actual docker images they run. The dockercompose health-check allows adding/overrriding healthchecks for images for someone who is … Read more