Ubuntu Docker installation in vmware (container building)

Ubuntu Docker installation in vmware (container building)

1. Mind Map

2. How to build a container

2.1 Preparing the experimental environment

(1) Environmental selection

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

runtime: runc. The default runtime for Docker.

Operating system: Ubuntu. Although there are container OSs like CoreOS, it is recommended to use the familiar system Ubuntu when you are just starting to learn.

(2) Install Docker

(2.1) Docker official tutorial: docs.docker.com/engine/installation

(2.2) Configure Docker's apt source:

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

②Add Docker's official GPG key;

③Add the Docker source to /etc/apt/sources.list

(2.3) Install Docker in Ubuntu

First, you need to verify whether Ubuntu supports Docker:

Docker requires Ubuntu kernel version 3.10 or higher. Check the prerequisites on this page to verify whether your Ubuntu version supports Docker.

$ uname -r

①Replace the Ubuntu official source with the domestic Alibaba source

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 software package, uninstall the erroneous package, and reinstall the correct version.

sudo apt-get -f install

④Update software

sudo apt-get upgrade

⑤Install the required packages:

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

⑥Add the GPG key and add the Docker-ce software source. Here we take the Docker-ce source of the 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 the package cache after adding successfully:

sudo apt update

⑧Install Docker-ce:

sudo apt install docker-ce

⑨ Set the boot-up auto-start and start Docker-ce (it has been set and started by default after successful installation and can be ignored):

sudo systemctl enable docker
sudo systemctl start docker

⑩Add the current user to the docker user group so that docker can be run without sudo.

sudo groupadd docker
sudo usermod -aG docker $USER

test:

docker run hello-world

⑪Start the docker service:

$ sudo service docker start

Test run:

$ docker run ubuntu:15.10 /bin/echo "Hello world"
docker: The Docker binary.
run: Combined with the previous docker to run a container.
ubuntu:15.10 specifies the image to run. Docker first checks whether the image exists on the local host. If it does not exist, Docker downloads the public image from the image repository Docker Hub.
/bin/echo "Hello world": command executed in the started container

PS: When running docker as a non-root user in ubuntu, an error will be reported. You need to execute the following command first:

sudo usermod -aG docker runoob

Order!!!

2.2 Run the first container

docker run -d -p 80:80 httpd

Summarize

The above is the introduction of Ubuntu Docker installation in vmware by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Docker builds a simple application stack and container Hello World access detailed explanation
  • Detailed explanation of the construction of Docker container visual monitoring center
  • Detailed explanation of using ELK to build a Docker containerized application log center
  • Running a Java Web project built with MyEclipse in a Dockerfile container in Docker
  • Detailed explanation of building a Mysql container + Tomcat container connection environment through Docker
  • Using Docker containers to build MySql master-slave replication
  • Detailed explanation of the process of building and running Docker containers

<<:  MySQL full-text index to achieve a simple version of the search engine example code

>>:  How to implement property hijacking with JavaScript defineProperty

Recommend

Some notes on mysql create routine permissions

1. If the user has the create routine permission,...

How to set the text in the select drop-down menu to scroll left and right

I want to use the marquee tag to set the font scro...

Steps for Docker to build its own local image repository

1. Environment and preparation 1. Ubuntu 14.04 2....

CSS transparent border background-clip magic

This article mainly introduces the wonderful use ...

Detailed explanation of the basic commands of Docker run process and image

Table of contents 1. Run workflow 2. Basic comman...

JavaScript Objects (details)

Table of contents JavaScript Objects 1. Definitio...

Detailed introduction to the MySQL installation tutorial under Windows

Table of contents 1. Some concepts you need to un...

Tomcat server security settings method

Tomcat is an HTTP server that is the official ref...

JavaScript to achieve a simple page countdown

This article example shares the specific code of ...

How to purchase and install Alibaba Cloud servers

1. Purchase a server In the example, the server p...

Example of using Vue built-in component keep-alive

Table of contents 1. Usage of keep-alive Example ...

Analysis of Docker's method for creating local images

The so-called container actually creates a readab...

JavaScript to switch multiple pictures

This article shares the specific code of JavaScri...