简体   繁体   中英

Does Docker host network break application portability?

I am containerizing a network-bound application. I want to deploy my containers with the Docker host network driver because it is the driver option that most minimizes latency.

Now let's say my container is based on ubuntu:latest and my host OS is CentOS. And let's also say my application has some network-related dependency on Ubuntu. Will my application work as expected?

What I'm ultimately driving at is whether there is any kind of isolation between host and container in terms of network when using the host driver, or do you essentially lose any portability when it comes to network dependencies?

If you specify --net host then there's no isolation between the container and the host network. On the other hand, if you're just doing straightforward TCP/UDP things, that's extremely portable across Unices and I wouldn't especially worry about host and container distributions not matching.

(If you start saying "ioctl" or "syscall" or directly use kernel headers for anything then it's worth worrying; if you depend on messing with iptables it can potentially get weird.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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