Skip to main content

Posts

Showing posts from April 8, 2019

Docker - Networking

Greetings!

When we talked about Docker, we said that containers are isolated. Then how do we communicate with our containers. Say we are using MySQL database. It is not useful if we can't access it.

Docker has a network concept. It has several network drivers to work with. Depending on how do we want out container to behave, we can select our network. This help us to communicate container with a container or container with host.


Network commands summarydocker network ls - list available networksdocker network create - create a networkdocker network rm - remove a networkdocker network inspect - inspect a networkdocker network connect - connect container to a networkdocker network disconnect - disconnect container from a network
Docker network driversbridge - This is the default network. When the Docker daemon service starts, it configures a virtual bridge names docker0. When we don't specify the network this is the one docker uses. Docker creates a private network inside the host…

Docker - Volumes

Greetings!

Sharing is caring. When the container is running/down or removed we need to access the data within it. Be it a database, web application logs it needs to share some form of data with host or with the other containers. Docker provides volume to achieve this.

Volumes are the preferred mechanism for persisting data generated by and used by Docker containers.

Volume commandsdocker volume create - create a volumedocker volume ls - list available volumesdocker volume remove - remove a volumedocker volume prune - remove all unused volumesdocker volume inspect - inspect a volume
Create a volumedocker volume create my-volume
List volumesdocker volume ls
Inspect a volumedocker volume inspect my-volume
Remove a volumedocker volume rm my-volume
Remove all unused volumesdocker volume prune
Start a container with a volume We can start a container with a volume using --mount or -v flag. As in the docs, New users should try --mount syntax which is simpler than --volume syntax.
If the volume does …

Docker - Images and Containers

Greetings!


Image An image is a read-only template with instructions for creating a Docker container. It is a combination of file system and parameters. Often, an image is based on another image with some additional customization.
We can use existing images or create our own images.

Container A container is a runnable instance of an image. We can create as many as we want from an image. Container is isolated from the host by default. We can modify it's behavior using network, volume, etc.
When a container is created, we can stop, restart, remove it.

Download an Image We can download a Docker image using 2 methods.
pull - we can use pull command to get an image$ docker image pull nginxcreate a container - when we create a container from an image, it downloads the image from the repository if it is not available in the host.$ docker container run nginx
Docker command structure There are many commands. So Docker has grouped them together into a common format.
docker COMMAND SUBCOMMAND docke…

Docker - Introduction

Greetings!

Let's talk about Docker container ;)

The Problem Software packaging, distribution, installation is not that easy. It is true that there are easy to use software packages. Normally software depends on other libraries. To install a software it needs to install those dependencies first. What if those libraries have other dependencies? What if there are version conflicts?

Let's see a picture of a software installation.



It is a web of libraries. Now imagine we need to uninstall our software. Will it remove it's dependencies properly. Will that have an impact on other software? How do we install another version? What if you need to main multiple computers with this same setup?

There are many questions though we can somehow solve. Imagine time, energy we spend on these. Is it worth?

Lets say we want install MySQL as the database. Why do we need to spend lot of time for that when our main task is something else. These are reasons we need to find other way to software dis…