* Introduction Docker
Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.
* Install Docker on Ubuntu/Linux Mintfont-family
Prerequisites:
- One Ubuntu 18.04 or Linux Mint 18.3 server set up by following the Ubuntu 18.04 initial server setup guide, including a sudo non-root user and a firewall.
- An account on Docker Hub if you wish to create your own images and push them to Docker Hub, as shown in Steps 6 and 7
Install:
Step 1 — Installing Docker:
- First, update your existing list of packages
sudo
apt update
- Install a few prerequisite packages
sudo apt install apt-transport-https ca-certificates curl software-properties-common
- Add the GPG key for the official Docker repository to your system
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- Add the Docker repository to APT sources
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
- Update the package database with the Docker packages from the newly added repository
sudo apt update
- Make sure you are about to install from the Docker repository instead of the default Ubuntu repository
apt-cache policy docker-ce
You will see output of apt-cache policy docker-ce. The version of Docker maybe different
- Last, install docker :D
sudo apt install docker-ce
- Check Docker run or not
sudo systemctl status docker
The output show that the service is active and running
* Use Docker
Step 2 — Using the Docker Command
- The syntax for the Docker with options, arguments
docker [option] [command] [arguments]
To view all subcommands
docker
Run 'docker COMMAND --help' for more information on a command
docker COMMAND --help
- To view system-wide information about Docker
docker info
Step 3 — Working with Docker Images
- Anyone can host their Docker images on Docker Hub. To check whether you can access and download images from Docker Hub
docker run openjdk
The first time when you get the image
The next time, you run, the result
- You can search for images available on Docker Hub by using the docker command with the search sub-command
docker search ubuntu