Ubuntu docker installation in VMware (container building)


1. Mind mapping

2. How to build a container

2.1 preparation of experimental environment

(1) Environment selection

Management tool: docker engine, because docker is the most popular and widely used;

runtime:runc。 The default runtime of docker.

Operating system: Ubuntu, although there is a container OS similar to coreos, but just started to learn, it is recommended to use the familiar system Ubuntu.

(2) Install docker

(2.1) official course of docker: docs.docker.com/engine/installation

(2.2) configure the apt source of docker:

① Install the package to allow the apt command HTTPS to access the docker source;

② Add the official GPG key of docker;

③ Add the source of docker to / etc / apt/ sources.list

(2.3) installing docker in Ubuntu

First, you need to verify whether Ubuntu supports docker:

Docker requires the kernel version of Ubuntu system to be higher than 3.10. Check the prerequisites on this page to verify that your Ubuntu version supports docker.

$ uname -r

① Replace Ubuntu official source with domestic alisource

vi /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main

deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe

② Update source:

sudo apt-get update

③ Repair the damaged package, uninstall the wrong package, and reinstall the correct version.

sudo apt-get -f install

④ Update software

sudo apt-get upgrade

⑤ Packages required for installation:

sudo apt install apt-transport-https ca-certificates software-properties-common curl

⑥ Add GPG key and docker CE software source. Take docker CE source of University of science and technology of China as an example:

curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \
$(lsb_release -cs) stable"

⑦ Update package cache after adding successfully:

sudo apt update

⑧ To install docker Ce:

sudo apt install docker-ce

⑨ Set the startup and start docker Ce (it is set and started by default after the installation is successful, which can be ignored):

sudo systemctl enable docker
sudo systemctl start docker

⑩ Add the current user to the docker user group. You can run docker without sudo.

sudo groupadd docker
sudo usermod -aG docker $USER


docker run hello-world

⑪ To start the docker service:

$ sudo service docker start

Test run:

$ docker run ubuntu:15.10 /bin/echo "Hello world"
Docker: the binary execution file of docker.
Run: combine with the previous docker to run a container.
ubuntu:15.10 Specifies the image to run. Docker first looks for the existence of the image from the local host. If not, docker will download the public image from the docker hub of the image warehouse.
/Bin / echo "Hello world": command executed in the boot container

When you run docker as a non root user in PS: Ubuntu, an error will be reported. You need to execute:

sudo usermod -aG docker runoob


2.2 running the first container

docker run -d -p 80:80 httpd


The above is the installation of Ubuntu docker in VMware introduced by Xiaobian to you. I hope it will help you. If you have any questions, please leave a message to me, and Xiaobian will reply you in time. Thank you very much for your support of the developepaer website!
If you think this article is helpful to you, welcome to reprint, please indicate the source, thank you!

Recommended Today

Python basics Chinese series tutorial · translation completed

Original: Python basics Python tutorial Protocol: CC by-nc-sa 4.0 Welcome anyone to participate and improve: a person can go very fast, but a group of people can go further. Online reading Apache CN learning resources catalog introduce Seven reasons to learn Python Why Python is great Learn Python introduction Executing Python scripts variable character string […]