For a small project, I want an application in a docker container to connect to the localhost of the machine. An answer to this question: From inside of a Docker container, how do I connect to the localhost of the machine? tells me the preferred way is to use --net="host"
in the docker run command.
I use a compose file to start the container. And this question told me the net
option was renamed to network_mode: "host"
.
Here is the beginning of the compose file
version: '3.6'
services:
shiny:
image: paulrougieux/eutradeflows
deploy:
restart_policy:
condition: on-failure
network_mode: "host"
ports:
- "3838:3838"
When I start this file
sudo docker stack deploy -c stackshiny.yml shiny
I get the error:
Ignoring unsupported options: network_mode
For information
$ sudo docker version
Client:
Version: 18.04.0-ce
Server:
Engine:
Version: 18.04.0-ce
How do I enable connection to a database on the host from a docker container?
5 Docker Version 18.04.0-ce ignores unsupported options: network_mode 1 Docker: Map port that doesn't start running in background 0 Access server ressource from the container (docker)
If you use the docker-compose command, use network_mode instead. – thisismydesign Nov 5 '19 at 15:36 Add a comment | Your Answer Thanks for contributing an answer to Stack Overflow!
Increased timeout for virtual machine boot startup to 2 minutes. Fix Docker For Windows unable to start in some cases: removed use of libgmp sometimes causing the vpnkit process to die. Windows Docker daemon is now started as service for better lifecycle management Store Linux daemon configuration in ~.docker\daemon.json instead of settings file
Fixes docker/for-win#1508 Add localhost port forwarder for Windows (thanks @simonferquel). Use Microsoft localhost port forwarder when it is available (insider build RS4). Display various component versions in About box. Fix vpnkit issue when username has spaces. See docker/for-win#1429 Diagnostic improvements to get VM logs before VM shutdown.
As stated in the docs for docker-compose file network_mode:
Notes This option is ignored when deploying a stack in swarm mode with a (version 3) Compose file. network_mode: "host" cannot be mixed with links.
The network_mode
cannot be used when deploying on docker swarm using docker stack deploy
. This is not new with version 18.04 but is rather older.
The network_mode
can only be used with docker-compose when deploying the container on the local machine using docker-compose up
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With