For OS, I’ve selected Ubuntu Server 17.10 and for using containers the engine should be installed and then one proceeds.
System preparation & Docker installation
First thing first, the system should be prepared for engine installation and this preparation includes the OS update & prerequisite installation; and for sure hostname and IP configuration has been done before all.
- Update apt package index
sudo apt-get update
- Install prerequisites
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y
- Add Docker official PGP key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
- Validate newly installed PGP key
sudo apt-key fingerprint 0EBFCD88
- Add the Docker repository to the repository list on the server
sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”
- Again, update apt package index to apply recent changes to the repository
sudo apt-get update
- Install Docker
sudo apt-get install docker-ce
- If it’s not production environment we can go to “Running the first container” section otherwise if the server is working (or would work) in the production environment, it’s recommended to select the version of Docker-CE which is stable; for this propose below command would list all possible versions.
apt-cache madison docker-ce
- After finding the suitable version for production environments based on the server
sudo apt-get install docker-ce=<VERSION>
Running the first container
For testing if everything works fine, we can use a simple image and deploy it in order to test connectivity as well as container deployment; to do so it’s possible to deploy a small container from Docker registry by running below command.
sudo docker run hello-world
Running above command would get and deploy a small container which going to show output directly into the console used for lunch command.
In the next post, I’d describe different docker commands and how to use them.
Reference: Get Docker CE for Ubuntu