简体   繁体   English

如何为Docker配置桥接网络?

[英]How do I configure a bridged network for Docker?

I'm new to Docker (have been working with KVM earlier). 我是Docker的新手(之前已经在KVM上工作)。 The first problem I ran in to was how to configure a bridged network in Docker. 我遇到的第一个问题是如何在Docker中配置桥接网络。 I would to have a similiar configuration as a KVM bridged network. 我将有一个类似的配置作为KVM桥接网络。 Does anyone know if this is possible? 有人知道这是否可能吗?

docker run --network=host

But if what you want is to access your container from outside use the port mapping option. 但是,如果要从外部访问容器,请使用端口映射选项。

docker run -p 80:80

You will access your container using the host ip and the port you specified. 您将使用主机ip和指定的端口访问容器。

Docker internally in linux use iptables to redirect the traffic from your host to the container. Linux内部的Docker使用iptables将流量从主机重定向到容器。

Regards 问候

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在桥接网络模式下从 Docker 容器获取接入点信息? - How do I get Access Point information from a Docker container in bridged network mode? 如何配置Docker以使其与ens34网络接口(而不是eth0)一起使用? - How do I configure Docker to work with my ens34 network interface (instead of eth0)? 如何使用docker-compose配置网络 - How to configure network using docker-compose 如何配置Docker以使用现有的本地网络 - How to configure docker to use existing local network 如何从docker容器中连接到主机网络? - How do I connect to to hosts network from within a docker container? 如何将我的服务暴露给内部 docker 网络? - How do I expose my service to the internal docker network? Boot2Docker:如何使用桥接网络访问容器 - Boot2Docker: how to access container with Bridged Networking 如何配置docker default bridge与异常的网络配置一起工作? - How to configure docker default bridge work with unusual network configuration? 如何配置RMI环境,以便能够在“真实”网络中使用它? - How do I have to configure a RMI environment so that I'm able to use it in a “real” network? 如何在网络内从另一个Docker容器引用一个Docker容器? - How do I refer to a docker container from another docker container, inside a network?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM