Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and use Docker on Linux

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly analyzes the relevant knowledge points of how to install and use Docker on Linux, the content is detailed and easy to understand, the operation details are reasonable, and has a certain reference value. If you are interested, you might as well follow the editor to have a look, and follow the editor to learn more about how to install and use Docker on Linux.

Docker is an open source application container engine based on the Go language and open source according to the Apache2.0 protocol. Docker allows developers to package their applications and dependencies into a lightweight, portable container and publish them to any popular Linux machine. Containers are completely sandboxed and do not have any interfaces to each other (similar to iPhone's app). More importantly, the container performance overhead is extremely low.

Installation of Docker in CentOS 7

The Docker package is already included in the default CentOS-Extras software source. So to install docker, simply run the following yum command:

[root@localhost ~] # yum install docker

View docker version

[root@localhost ~] # docker versionClient: Version: 1.8.3 API version: 1.20 Go version: go1.4.2 Git commit: cedd534-dirty Built: Fri Jan 22 06:07:01 UTC 2016 OS/Arch: linux/amd64Server: Version: 1.8.3 API version: 1.20 Go version: go1.4.2 Git commit: cedd534-dirty Built: Fri Jan 22 06:07:01 UTC 2016 OS/Arch: linux/amd64

The display version is docker 1.83 Magi API version 1.20.

Start the Docker service

After the installation is complete, use the following command to start the docker service and set it to boot:

[root@localhost ~] # systemctl start docker.service [root@localhost ~] # systemctl enable docker.service

Download the official CentOS image to local

[root@localhost ~] # docker pull centosPulling repository centos192178b11d36: Download complete 70441cac1ed5: Download complete ae0c2d0bdc10: Download complete 511136ea3c5a: Download complete 5b12ef8fd570: Download complete

Confirm that the CentOS image has been obtained

[root@localhost ~] # docker images centosREPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEcentos centos5 192178b11d36 2 weeks ago 466.9 MBcentos centos6 70441cac1ed5 2 weeks ago 215.8 MBcentos centos7 ae0c2d0bdc10 2 weeks ago 224 MBcentos latest ae0c2d0bdc10 2 weeks ago 224 MB

Run a Docker container

[root@localhost] # docker run-I-t centos / bin/bash [root@dbf66395436d /] #

We can see that the CentOS container has been started, and we see the bash prompt. In the docker command, we used the "- I capture standard input and output" and "- t assign a terminal or console" options.

To disconnect from the container, enter exit.

[root@cd05639b3f5c /] # cat / etc/redhat-release CentOS Linux release 7.0.1406 (Core) [root@cd05639b3f5c /] # exitexit [root@localhost ~] #

We can also search containers based on Fedora and Ubuntu operating systems

[root@localhost ~] # docker search ubuntu [root@localhost ~] # docker search fedora

Displays a list of currently running containers

[root@localhost ~] # docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESe422481ac1ce daocloud.io/daocloud/dao-2048 "nginx-g'daemon off" 45 hours ago Up 45 hours 0.0.0.0 daemon off 32768-> 80/tcp hungry_visvesvaraya on "Linux" That's all for how to install and use Docker. For more information, you can search for previous articles. Hope to help you answer questions and questions, please support the website!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report