I am trying to use multiple containers defined together in the following docker-compose .yml
file
services:
mobile_app:
container_name: mobile_app # optional
build:
context: .
dockerfile: Dockerfile # optional, default is Dockerfile in context
ports:
- 19000:19000
- 19001:19001
- 19002:19002
environment:
- EXPO_DEVTOOLS_LISTEN_ADDRESS=0.0.0.0
# - CHOKIDAR_USEPOLLING=true # Drains batterty, to be checked without usage, used for hot reload
- REACT_NATIVE_PACKAGER_HOSTNAME=<?????????> # TODO: USE YOUR IPV4 address without any port
- MONGODB_CONNSTRING=mongodb://root:secret@mongodb # (experimental)
volumes:
- type: volume
source: sihv
target: /root/app/
volume:
nocopy: true
# - code:/root/workspace/app # TODO: change to your workspace
auth_server:
container_name: auth_server
build:
context: .
dockerfile: Dockerfile.auth_server
ports:
- 1111:1111
volumes:
- type: volume
source: sihv
target: /root/servers/auth
volume:
nocopy: true
# - code:/root/workspace/servers/auth
mongodb:
container_name: mongodb
image: mongo
ports:
- 27018:27017
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=secret
- MONGO_INITDB_DATABASE=db
volumes:
- "C:\\Users\\Public\\db:/data/db" # mount is in the local machine
volumes:
sihv:
external: true
when i start it, it runs fine as
but the sihv in docker dashboard is empty
when I try to attach to multiple .devcontainer.jsons stored as in the following file structure
when I open multiple devcontainers seperately on different vscode windows and create a directory say "a", it's reflecting at these multiple locations in same volume
is there a way to resolve both of these issues..? and is there anything wrong with the declaration in docker compose file??
After changing above docker-compose.yml to the one below, it works now
services:
mobile_app:
container_name: mobile_app # optional
build:
context: .
dockerfile: Dockerfile # optional, default is Dockerfile in context
ports:
- 19000:19000
- 19001:19001
- 19002:19002
environment:
- EXPO_DEVTOOLS_LISTEN_ADDRESS=0.0.0.0
- REACT_NATIVE_PACKAGER_HOSTNAME=<????????> # TODO: USE YOUR IPV4 address without any port
- MONGODB_CONNSTRING=mongodb://root:secret@mongodb # (experimental)
volumes:
- type: volume
source: sih_mobile_app
target: /root/app/
volume:
nocopy: true
# - code:/root/workspace/app # TODO: change to your workspace
auth_server:
container_name: auth_server
build:
context: .
dockerfile: Dockerfile.auth_server
ports:
- 1111:1111
volumes:
- type: volume
source: sih_server_auth
target: /root/servers/auth
volume:
nocopy: true
# - code:/root/workspace/servers/auth
mongodb:
container_name: mongodb
image: mongo
ports:
- 27018:27017
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=secret
- MONGO_INITDB_DATABASE=db
volumes:
- sih_mongodbv:/data/db # mount is in the local machine
sih_flask1:
container_name: sih_flask1
build:
context: .
dockerfile: Dockerfile.flask1
ports:
- 8012:8012
volumes:
- sih_flask1:/tf
sih_flask2:
container_name: sih_flask2
build:
context: .
dockerfile: Dockerfile.flask2
ports:
- 8016:8016
volumes:
- sih_flask2:/tf
volumes:
sih_mobile_app:
name: sih_mobile_app
sih_server_auth:
name: sih_server_auth
sih_mongodbv:
name: sih_mongodbv
sih_flask1:
name: sih_flask1
sih_flask2:
name: sih_flask2