Good afternoon, there is a problem, it is necessary to close access to all containers from the world except locale.
version: '2' services: mongodb: image: 'bitnami/mongodb:latest' network_mode: "host" volumes: - /bitnami/mongo:/bitnami ports: - "127.0.0.1:27017:27017" environment: - MONGODB_ROOT_PASSWORD=password123 redis: image: 'bitnami/redis:latest' network_mode: "host" volumes: - /bitnami/redis:/bitnami ports: - '127.0.0.1:6379:6379' environment: - REDIS_PASSWORD=password123 main: build: . network_mode: "host" ports: - "127.0.0.1:8080:8080" volumes: - .:/code - /settings:/go/settings/ That's where root @ localhost: ~ # netstat -plnt
Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:5000 0.0.0.0:* LISTEN 2774/nginx: worker tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN 3224/mongod tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 3097/redis-server 0 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2774/nginx: worker tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 29048/sshd tcp6 0 0 :::22 :::* LISTEN 29048/sshd tcp6 0 0 :::8000 :::* LISTEN 3282/code That says that containers are open for access from the outside. It is necessary to close everything and give access only through lokalkhost.