D.O Feature Pic 3

Digital Office – Part 2

Home » Linux » Digital Office – Part 2

Table of Contents

Docker Engine

Docker Engine is a container that runs your application in an isolated environment, almost like a virtual machine. This is really good, especially when running multiple server applications or just want to test them without making serious changes on the base server. 

For examples like chat, wiki, project management, cloud service, etc like in our case. I have also read, it is also used in development areas when creating apps.

Downside is it can be tricky to maintain the docker but with Portainer you will be able to manage this with ease. I will introduce Portainer Manager in my next blog post.

It may in some cases have noticeable performance penalties. But for the most situations what I have read about, it’s just a few milliseconds we are talking about.

Preparation

  • Before installing Docker, you should uninstall the older version to avoid conflicts. This will not affect the previous content installed inside Docker.
    This will probably generate some error message in case you not have docker installed, it tells none of these packages are installed. But that is okay.

    If you like to totally remove everything you can read that more in Docker manual.

				
					sudo apt-get remove docker docker-engine docker.io containerd runc
				
			
  • Then let’s do an update first and install all packages to allow apt to use a repository over HTTPS. These are necessary things for the Docker Engine.
				
					sudo apt-get update
				
			
				
					sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
				
			

Repository Setup

  • We will install the Docker Engine with a repository, so first get the Docker’s official GPG key.
				
					curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
				
			
  • Then we choose the stable version in the repository, in this case we use the “x86_64 / amd64” stable repository. For more info look in Docker manual.
				
					echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
				
			

Installation

  • Once again do an update. Then install all parts that include in the Docker Engine.
				
					sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
				
			

Testing

  • We can test the Docker Engine to see if it works correctly by downloading the classic “Hello World” docker image.
				
					sudo docker run hello-world
				
			
  • We would get a similar message like this below. And it tells if the docker works.
    (see line 7 and 8)
				
					Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete 
Digest: sha256:df5f5184104426b65967e016ff2ac0bfcd44ad7899ca3bbcf8e44e4461491a9e
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

				
			

Docker Compose

Docker Compose is used for defining and running multi-container applications in Docker Engine. You do that by writing a YAML file. Then you can start all the services based on one single command.

Download

  • First download the latest version of Docker Compose, at this writing time it’s version 1.29.2. You can find the latest version number at Docker manual.
				
					sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
				
			

Setup

  • To be able to execute the binary we need to apply executable permissions to the binary.
				
					sudo chmod +x /usr/local/bin/docker-compose
				
			

Testing

  • Test the installation, by just do a version check of the current Compose.
				
					docker-compose --version
				
			
  • Then you will get a message similar to this. That means it works alright.
				
					docker-compose version 1.29.2, build 1110ad01
				
			

This is all for this post about Docker Engine and Docker Compose. There is more terminal commands and how to control this docker. But I skip this because we will do the management in a tool called Portainer.

And if something is seems wrong or missing please comment about it. I will gladly read and answer them.

Keep tune in here for the next post about “Portainer” setup. 

Until next time, stay safe and happy experimenting.

Blog Updates

  • 2021-11-09
    • Corrected some text in the guide.
    • Made sure the content is [Up To Date].
Facebook
Twitter
LinkedIn