Docker – Can’t access Django server

Your issue: CMD [“python”, “manage.py”, “runserver”, “8000”] In order for it to work, you need to change it to: CMD [“python”, “manage.py”, “runserver”, “0.0.0.0:8000”] and finally, go to http://127.0.0.1:8000/ in your browser. Why? Well, Python thinks you’re exposing it on 127.0.0.1 when in reality you want the eth0 address, since that can change, and we … Read more

Reuse image built by one service in another service

Docker Compose builds your image with the name proj_master, beacuse you did not specify an image name under your master service in the Compose file. You have a build section, so Docker Compose will build the image and give it a name based on your <directory_name_where_you_run_compose>_<service_name>:latest. I did not find this in the documentation, but … Read more

MongoDB on with Docker “failed to connect to server [localhost:27017] on first connect “

By default Compose sets up a single network for your app. Each container for a service joins the default network and is both reachable by other containers on that network, and discoverable by them at a hostname identical to the container name. According to your docker-compose.yaml file you can access you mongo container on 127.0.0.1:27017 … Read more

Docker compose create kafka topics

The simplest way is to start a separate container inside the docker-compose file (called init-kafka in the example below) to launch the various kafka-topics –create … commands, while first making it wait for Kafka to be reachble by simply running kafka-topics –list …. Like this: version: ‘2.1’ services: zookeeper: image: confluentinc/cp-zookeeper:6.1.1 ports: – “2181:2181” environment: … Read more

Pass args to the Dockerfile from docker-compose

the key word ARG has a different scope before and after the FROM instruction Try using ARG twice in your Dockerfile, and/or you can try the ENV variables ARG LANDING_PAGE_DOMAIN FROM nginx:alpine COPY nginx.conf /etc/nginx/nginx.conf COPY production/* /etc/nginx/conf.d/ ARG LANDING_PAGE_DOMAIN ENV LANDING_PAGE_DOMAIN=${LANDING_PAGE_DOMAIN} RUN sed -i s/{LANDING_PAGE_DOMAIN}/${LANDING_PAGE_DOMAIN}/g /etc/nginx/conf.d/landing.conf EXPOSE 80 443