Docker Toolbox Ubuntu



Docker takes care of the networking aspects so that the containers can communicate with other containers and also with the Docker Host. If you do an ifconfig on the Docker Host, you will see the Docker Ethernet adapter. This adapter is created when Docker is installed on the Docker Host. This is a bridge between the Docker Host and the Linux Host. Like I said: Docker engine is something different than Docker compose. So you can installl the docker engine and just work with docker but when you want to use docker compose you need to install it seperatly (where the installation of the engine is a prerequisition (you've alread done this)). To continue with this cheat sheet, right click the Docker icon in the system tray, and go to settings. In order to mount volumes, the C:/ drive will need to be enabled in the settings to that information can be passed into the containers (later described in this article).

  • Docker Tutorial
  • Docker Useful Resources
Toolbox
  • Selected Reading

Docker takes care of the networking aspects so that the containers can communicate with other containers and also with the Docker Host. If you do an ifconfig on the Docker Host, you will see the Docker Ethernet adapter. This adapter is created when Docker is installed on the Docker Host.

This is a bridge between the Docker Host and the Linux Host. Now let’s look at some commands associated with networking in Docker.

Listing All Docker Networks

This command can be used to list all the networks associated with Docker on the host.

Syntax

DockerInstall

Options

None

Return Value

Docker toolbox for ubuntu

The command will output all the networks on the Docker Host.

Docker

Example

Output

The output of the above command is shown below

Inspecting a Docker network

If you want to see more details on the network associated with Docker, you can use the Docker network inspect command.

Syntax

Options

  • networkname − This is the name of the network you need to inspect.

Return Value

The command will output all the details about the network.

Example

Docker Toolbox Ubuntu 16.04

Output

The output of the above command is shown below −

Now let’s run a container and see what happens when we inspect the network again. Let’s spin up an Ubuntu container with the following command −

Now if we inspect our network name via the following command, you will now see that the container is attached to the bridge.

Creating Your Own New Network

One can create a network in Docker before launching containers. This can be done with the following command −

Syntax

Options

Download Docker Toolbox For Ubuntu

  • drivername − This is the name used for the network driver.

  • name − This is the name given to the network.

Return Value

The command will output the long ID for the new network.

Example

Output

The output of the above command is shown below −

Docker Toolbox Ubuntu 18.04

You can now attach the new network when launching the container. So let’s spin up an Ubuntu container with the following command −

Docker Toolbox For Ubuntu

And now when you inspect the network via the following command, you will see the container attached to the network.