How can I use two different docker container on the production server (after pushing to DockerHub)?
I have the docker-compose
file with two containers. “nginx” container depends on “demo” (it’s python django backend).
version: '3.9'
volumes:
static:
services:
demo:
image: findsimilar/demo
build:
context: .
restart: always
expose:
- 8080
volumes:
- static:/static/
command: bash -c "
python manage.py collectstatic --noinput --settings=demo.prod_settings
&& gunicorn demo.wsgi -b 0.0.0.0:8080
"
nginx:
image: findsimilar/demo-nginx
build: ./nginx
restart: always
ports:
- 80:80
volumes:
- static:/etc/nginx/static/
depends_on:
- demo
I’ve done docker compose build
and docker compose push
.
Images have been pushed on DockerHub.
The question is “How can I properly use this images on production server?”
I’ve tried docker run findsimilar/demo
and docker run findesimilar/demo-nginx
.
The images have been pulled but findsimilar/demo
haven’t been started and findsimilar/demo-nginx
didn’t find a demo:8080 host.
Read more here: Source link