This post is part of a series about Docker, including: Docker Introduction Docker: Install software inside a container Docker Volumes Docker Networking - bridge container to host NIC We started with the basics and moved on with adding software, using volumes and then bridging a container to the network. As a said I’m neither a developer or a system administrator, I work as Network Engineer so I’m not the main target for Docker but I found it very useful for a specific need and now it’s time to join the dots.
This post is part of a series about Docker, including: Docker Introduction Docker: Install software inside a container Docker Volumes Today we’ll see Docker networking with a very specific target in mind: bridge container to the host network. This isn’t supposed to be the way of work of containers: a container should be created to run a single application so container networking, from the point of view of a Network Engineer, is essentialy a Port Address Translation with a firewall exception.
In the last post we saw that any filesystem change inside a docker container is lost if not commited to the image. What if we want to share data between containers? We can use Docker’s Data Volumes and Data Volume Containers. Data Volumes or Data Volume Containers? Data Volumes feature allows us to mount a local directory from the host inside a container. That looks good but somehow it breaks the concept of isolation between host and container.
In the first post of this series we left with a running Ubuntu 15.04 container. Now it’s time to install software inside the container. A container is “stateless”, meaning any file change inside a container is lost when the container is closed, including software installations. Install software To install software inside a container any method supported for the Linux distribution is fine. I usually install Python 2.7, iftop, htop, tmux so let’s run a container:
Docker and more generic Linux containers technology are a hot topic these days. The website says “for developers and sysadmins”, I am neither of the two but I can still find some useful applications for containers as a Network Engineer. Let’s start from the basics. Install docker and first run We can apt-get to install docker on Ubuntu Linux: apt-get install docker.io Now start docker service: service docker start That was easy.