Docker those things in the Ubuntu environment

Docker those things in the Ubuntu environment

0. Introduction

This section mainly describes the configuration and push usage of Docker under Ubuntu 18.04.

1. Installation

The apt source uses HTTPS to ensure that the software is not tampered with during the download process.

Therefore, we first need to add the package using HTTPS transmission and the CA certificate.

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

In order to confirm the validity of the downloaded software package, you need to add the GPG key of the software source

curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

Add apt source: add Docker software source to source.list:

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

Install Docker CE

sudo apt-get install docker-ce

Start Docker CE

sudo systemctl enable docker
sudo systemctl start docker

2. User groups and tests

The docker command uses Unix socket to communicate with the Docker engine. Only the root user and users in the docker group can access the Unix socket of the Docker engine. For security reasons, the root user will not be used directly on Linux systems. Therefore, it is better to add users who need to use docker to the docker user group.

Create the docker group:

sudo groupadd docker

It may be prompted that it already exists, and then follow up operations.

Add the current user to the docker group:

sudo usermod -aG docker $USER

Exit the current terminal and log in again to test whether Docker is installed correctly:

docker run hello-world

The output is as follows:

( base) light@city:~/myRoute/k8s/app$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1 b930d010525: Pull complete
Digest: sha256:9572f7cdcee8591948c2963463447a53466950b3fc15a247fcad1917ca215a2f
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:1. The Docker client contacted the Docker daemon.2. The Docker daemon pulled the "hello-world" image from the Docker Hub.(amd64)3. The Docker daemon created a newcontainerfrom that image which runs the
 executable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent it
 to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

This step may report a TSL error, just configure the domestic mirror source: daemon.json may not exist, just create it.

vi /etc/docker/daemon.json

Configure the following:

{" registry-mirrors":["https://dockerhub.azk8s.cn","https://hub-mirror.c.163.com"]}

Restart the service:

sudo systemctl daemon-reload
sudo systemctl restart docker

3. push a mirror

Register an account on Docker Hub first.

https://hub.docker.com/

We can publish the above hello-world to our account.

First, see if there is this mirror:

docker image ls

Output:

hello-world            latest              fce289e99eb9        13 months ago       1.84kB

Mark it into your own warehouse:

docker tag hello-world lightcity/hello-world:v1

Push to your own warehouse:

docker push lightcity/hello-world:v1

Directly this will not push up, first execute the following:

docker login

Then push again.

push up and see it in your warehouse

Recommended Posts

Docker those things in the Ubuntu environment
Resolve the problems encountered in the linux environment under ubuntu
Encountered in the process of building a virtual environment in ubuntu
Install and configure Docker in Ubuntu
Docker ubuntu: install python-PIL-image environment on 14.04
The locate file search command in Ubuntu16.04
Build the C++ compilation environment under ubuntu
Configure Java development environment in Ubuntu20.04 LTS
About installing node environment in Ubuntu server
Install Ubuntu 18.04 in the virtual machine VMware
Download OpenJDK11 source code in Ubuntu environment
Disable the TinkPad touch screen in Ubuntu
Edit OpenJDK11 source code in Ubuntu environment
How to configure TensorFlow use environment in Ubuntu
ubuntu18.04 install docker
How to install python in ubuntu server environment
How to open the ubuntu system in win10
Install Python3 environment in a brand new Ubuntu
The consequences of uninstalling python in ubuntu, very
Remotely connect to MySQL database in Ubuntu environment
Introduction to the use of Hanlp in ubuntu
Mount the disk in a directory under Ubuntu 18.04
Turn off and turn on the firewall in ubuntu
Installation and use of SSH in Ubuntu environment
The difference between CentOS and Ubuntu in Linux system
How to create a Python virtual environment in Ubuntu 14.04
Tutorial for setting up FTP server in Ubuntu 16.04 environment
Install mysql-pytho in Ubuntu
Nagios3 in ubuntu serve
ubuntu16.04 deploy GPU environment
Install docker on Ubuntu
Install Docker on ubuntu18.04
Use supervisor in ubuntu
Ubuntu development environment configuration
Python virtual environment: Ubuntu16.04
Ubuntu Touch environment setup
Install python in Ubuntu
Install JDK in Ubuntu19.10
Ubuntu18.10 configure Java environment
Install Docker on Ubuntu18
ubuntu environment deployment project
How to control the ubuntu system in win10 through ssh
The problem of MySQL import file failure in CentOS environment
Mac uses vnc to remotely log in to the ubuntu16.04 desktop
Detailed steps to automatically set the line number in ubuntu16.04
How to install memcache and start it in ubuntu environment
Detailed steps for installing Django under Python 3.6 in Ubuntu 16.04 environment
How to compile and install PHP and Nginx in Ubuntu environment