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 download and install docker

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to download and install docker". The content in the article is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn "how to download and install docker".

Introduction to docker:

Docker means porter in English. Dock worker docker is a container (container) that developers can handle. Developers can package their applications and dependencies into a container that can be handled, and then transport them to any linux machine (kernel version is required, kernel versions above redhat6.5 can work properly), thus solving the problem every time a new environment needs to be deployed. Those tedious dependencies on package installation to build a standardized running environment.

Install under the cent6.5x64 bit

Install epel

# rpm-ivh epel-release-6-8.noarch.rpm

Install docker-io

Yum-y install docker-io

Start the docker process

Service docker start

Boot self-start

Chkconfig docker on

View the version of docker

Download the image:

Docker pull ubuntu

Launch a container interactively

Docker run-I-t-- name= "test" >

#-I,-- interactive=false Keep STDIN open even if not attached

#-t,-- tty=false Allocate a pseudo-TTY

Root@xxxxxx: / # # xxxxx is the ID number of the container. The ID number of each container is unique. When the container exits, the container exits interactively.

# docker ps-a can see the container we just created

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

C072b649fe5b ubuntu:latest "/ bin/bash" 5 minutes ago Exited (0) 5 seconds ago test

Restart the container if you want to reconnect

# docker run test

# docker attach test # you can deploy the environment you need here

# docker start test # launch the container

# docker stop test # stop the container

Exit when the environment deployment is complete

# install openssh-server

Apt-get install openssh-server

Modify / etc/sshd/ssh_config # to log in to the container from the host

PermitRootLogin yes

UsePAM no

# passwd can change a password

# docker commit test ubtest# generates a new image of the container

# docker save ubtest > test.tar # package the image

# load packaged images on the machines to be deployed

# docker load < test.tar

Docker images # View the image we just imported

# start the container

Docker run-d-p 2012 usr/sbin/sshd 22 ubtest (mirror) / usr/sbin/sshd-D # put the container running in the background

# ssh-p 2012 127.0.0.1 can be connected to try to connect to the container

Thank you for reading, the above is the content of "how to download and install docker". After the study of this article, I believe you have a deeper understanding of how to download and install docker, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Servers

Wechat

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

12
Report