官术网_书友最值得收藏!

Installing Docker CE via the Docker Repository

We need to set up the Docker repository first, and then we can do the installation, so let's take care of the repo now.

The first step will be to update the apt package index. Use the following command to do that:

# update apt-get libraries
sudo apt-get update

Now we need to install some supporting packages:

# install required packages
sudo apt-get install \

apt-transport-https \
ca-certificates \
curl \
software-properties-common

Next, we need to get the GPG key for Docker:

# get the GPG key for docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
sudo apt-key add -

You can confirm that you have added Docker's GPG key successfully; it will have a fingerprint of 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88

You can verify the key by checking the last eight characters match 0EBFCD88 with this command:

# validating the docker GPG key is installed
sudo apt-key fingerprint 0EBFCD88

Finally, we need to actually set up the repository. We will be focusing on the stable repo for our examples.

If you want to install the edge or test versions of Docker CE, be sure to add the word edge or test after the word stable (do not replace the word stable) in the following command:

# adding the docker repository
sudo add-apt-repository \

"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

Now that our system is set up with the correct repository for installing Docker CE, let's install it.

Start by making sure that all of the packages are up to date by issuing the apt-get update command:

# update apt-get libraries again
sudo apt-get update

And now we will actually install Docker CE:

# install docker
sudo apt-get install docker-ce

Docker is installed. You can check the Docker version after the install to confirm a successful installation:

# validate install with version command
docker --version

The version command should look something like this:

Now, let's validate that the Docker installation is working as desired. To do this, we will run the hello-world Docker image using the following command:

# validating functionality by running a container
sudo docker run hello-world

Did you notice something interesting happened?

We did not have to start Docker after the installation as we did in the CentOS installation. That is because, on DEB-based Linux systems, the install process also starts Docker for us. Additionally, the Ubuntu workstation is configured to start Docker on boot. So both of the Docker start steps are handled for you during the installation. Nice! Your Ubuntu workstation now has Docker installed and we've verified it is working as desired. 

Although using the Docker repository is the best way to install Docker on your workstation, let's take a quick look at another way to install Docker CE on an Ubuntu workstation, that being by manually installing it with a DEB package.

主站蜘蛛池模板: 宝兴县| 察隅县| 芦山县| 微博| 七台河市| 通榆县| 循化| 平南县| 黄梅县| 桐乡市| 石林| 仁化县| 新田县| 凤城市| 疏勒县| 桦南县| 临海市| 正定县| 子洲县| 兰西县| 永仁县| 邳州市| 华坪县| 满洲里市| 荔浦县| 莆田市| 潜江市| 澄江县| 阳高县| 肥东县| 兰考县| 隆回县| 始兴县| 平度市| 台前县| 温州市| 广饶县| 镇江市| 义乌市| 灌南县| 商洛市|