简体   繁体   English

Docker 在多个主机上(Windows 和 Ubuntu)

[英]Docker on several hosts (Windows and Ubuntu)

I have 2 hosts with Docker: Ubuntu and Windows(docker-desktop).我有 2 台主机使用 Docker:Ubuntu 和 Windows(docker-desktop)。 I want to connect a container with Adminer(Windows) to a container with MariaDB(Ubuntu).我想将带有 Adminer(Windows) 的容器连接到带有 MariaDB(Ubuntu) 的容器。 Is it possible?可能吗?
My hosts locate in the same local network, and containers are isolated from each other(of course).我的主机位于同一个本地网络中,并且容器彼此隔离(当然)。 I was trying to create overlay network and to bind between each other, but worker's message has been: "docker: Error response from daemon: attaching to network failed, make sure your network options are correct and check manager logs: context deadline exceeded."我试图创建覆盖网络并相互绑定,但工作人员的消息是:“docker:来自守护进程的错误响应:连接到网络失败,请确保您的网络选项正确并检查管理器日志:超出上下文期限。”
My goal is to make communication between different host containers.我的目标是在不同的主机容器之间进行通信。 Please, can you help me with my problem:)拜托,你能帮我解决我的问题吗:)

  • Important: Make sure your host machines can communicate with each other over the network, and there are no issues due to network firewalls, etc.重要提示:确保您的主机可以通过网络相互通信,并且不存在由于网络防火墙等原因造成的问题。
  • Looks like need to bind the port of your container to your host machine.看起来需要将容器的端口绑定到主机。
  • When you are running your Docker containers use the -p option.当您运行 Docker 容器时,请使用 -p 选项。 You can find a lot of examples athttps://docs.docker.com/config/containers/container-networking/ .您可以在https://docs.docker.com/config/containers/container-networking/找到很多示例。
  • After you have exposed your containers port, you can access them using <host-machine-ip>:<host-machine-port-you-used-to-bind-container>公开容器端口后,可以使用<host-machine-ip>:<host-machine-port-you-used-to-bind-container>访问它们

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM