Why Docker?
We love Docker because it is an open source containerized platform with the following capabilities:
- The app is lightweight and has more granular updates. With docker only one process can run in each container. This makes it possible to build an application that can continue running even if one of its parts is pulled down for an update, it will still continue working as if nothing is wrong.
- Docker container images are very portable. This means Docker run without any modification across a data center, desktop environment or even on a server on the cloud environment.
- Docker works with what we call container versioning. This is where docker tracks the versions of a container image , whenever their is an update and rollback is required it is done seamlessly. It can also update the repository between an existing version and new one.
- Docker run on automated scripts, it can automatically build a container based on application source code provided.
Docker used terms
- Docker Cluster: this is a group of machines that work together to run workloads and provides high availability.
- Docker Compose: This is a tool used for running multi container applications on docker. A compose file is used to define how one or more containers that make up your application are configured.
- Docker Container: A container is a running instance of a docker image.
- Docker Hub: This is a centralized resource for working with docker. It is a central repository for container images.
- Dockerfile: This is a text document that contains all the commands a user can call on a command line to assemble an image.
- Docker build: Docker build command builds an image from a dockerfile and context. The build context is a set of files at a specified location PATH or URL.
# sudo pacman -S docker# sudo pacman Syu
# sudo pacman -S git# git clone https://aur.archlinux.org/docker-git.git
For us to build from the source we need some tools to aid us in building it, these tools falls under ‘base-devel’ package. Now we need to download the required packages using pacman.
                        
                        # sudo pacman -S base-devel# cd docker-git/
# makepkg -sri# sudo systemctl start docker.service
It always become a nuisance starting the daemon every time you boot up your operating system, we need to ensure our daemon is up and running every time by doing the following:
# sudo systemctl enable docker.serviceAdding User to a group.
Adding users in Docker is a way to make all management work become easy. We create users which can run day today activities without undermining the functionality of the system. Anyone you add to the group has root rights. We use the following command to do so.
$ sudo usermod -aG docker $USERAfter adding user, verify that you can docker commands without sudo. Use the following command to do so
$ docker run hello-worldUseful Docker commands
Docker run
Docker run creates and start a container.
Docker start
It starts a stopped container
Docker stop
It stops a running container
Docker volume create
It creates a volume to be used by the container
Docker rm
It removes a container
Docker ps
It shows the health status of the container