Tuesday, May 18, 2021
Home CONTAINERIZATION Can docker container access the host network?

Can docker container access the host network?

Yes, A docker container can access the host network if it is started with the correct parameters and Docker host policies/controls allowing to do so. When a container is starting you can set the networking option with –network host option likedocker container run --rm -d --network host --name my_nginx nginx command.

In this way, the container network stack will be the same as the docker host network stack. When a process tries to listen to a port in the container namespace it will actually try to listen on the Docker host network interface.

Previous articleHello world!
Next articleWhen to use volume in Docker?
Burak Cansizogluhttp://devopsmania.com/
Burak is working as a freelance Cloud/DevOps consultant. He performed different roles during his professional career track. He has more than 12 years of experience in the finance, telecommunication and government sectors. He likes to learn new technologies and wants to share his knowledge, experiences with the community. He likes all lean, agile initiatives. And he believes that the DevOps mindset and DevOps transformation will bring more agility to the Enterprises as well as employees.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular

Jenkins. Invalid agent type “docker” specified. Must be one of [any, label, none]

Jenkins is working with plugins, if you didn't install Docker and Docker Pipeline plugins you can get this error. "Jenkins. Invalid agent...

How to install Minishift on Windows10?

Minishift is the compact all-in-one solution of OpenShift community distribution in a Virtual Machine(VM). It allows developers and curious minds to run...

How is Docker different from a Virtual Machine?

Docker containers are isolated processes within their namespaces. Virtual Machines are full-blown Operating Systems (OS) living on Hypervisors. In this article, we...

How to run a Docker Container in Detached Mode?

When you are running your Docker containers, you can attach them to your current shell or run them as background tasks in...

Recent Comments