I have two docker containers. I’m trying to curl between one and the other container.
I’ve set up a common network.
Here is my docker-compose:
version: '3.8'
services:
web:
build: ./webapp/.
container_name: storyweb
command: python3 /app/manage.py runserver 0.0.0.0:8000
volumes:
- ./webapp/:/app/
ports:
- 8007:8000
networks:
- backend
env_file:
- ./.env.dev
novnc:
container_name: dramatica
build: ./dramatica/.
environment:
# Adjust to your screen size
- DISPLAY_WIDTH=1200
- DISPLAY_HEIGHT=800
- PUID=1000
- PGID=1000
ports:
- "8008:8080"
volumes:
- ./dramatica:/app
networks:
- backend
restart: unless-stopped
depends_on:
- web
entrypoint: /app/entrypoint.sh
networks:
backend:
driver: bridge
I’m tryin gto curl from inside vovnc container:
curl -i web:8007
I’ve also tried storyweb.
Any idea why this is not working?
2
Answers
When your server container runs a server process
connections between containers need to go to that port 8000.
ports:
aren’t used or required here, and can be removed if you don’t require the service to be directly accessible from outside containers on the same Docker network.If you are trying the command
curl -i web:8007
from your host machine. It will not work. You try this command from inside a container. You can try the following methodcurl -i localhost:8007
docker-compose novnc curl -i web:8007