Reputation: 710
I have a docker-compose.yaml to create containers
version: '2.4'
app:
hostname: app
build: .
environment:
PYTHONUNBUFFERED: 1
PYTHONDONTWRITEBYTECODE: 1
networks:
app_net:
ipv4_address: 192.168.10.10
user: "root:root"
command: /bin/bash -c "tail -f /dev/null"
networks:
app_net:
driver: bridge
ipam:
driver: default
config:
- subnet: 192.168.10.0/24
gateway: 192.168.10.1
outside:
external: true
I successfully created a container but unable to access the app through a browser in a host machine.
I typed 192.168.10.10 in browser to access but it made timeout error
Upvotes: 0
Views: 90
Reputation: 11822
In docker-compose file add this line:
app:
hostname: app
build: .
ports:
- "port:port01"
Port
is port you would like to expose to outside. You can check on host by access URL http://localhost:port
port01
is port which is configure in Dockerfile, its application port.
Upvotes: 1