Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to install the docker container

Shulou Source: shulou.com Published: 2022-06-01 02:38:35 09月22日 Update

How to install docker containers, I believe many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

First of all, you need to prepare an operating system for CentOS, and the virtual machine can also be used. Must be a 64-bit operating system, kernel 3.8 or above is recommended.

Install docker

The Docker software can be installed with the following command

Yum-y install docker-io

You can use the following command to see if Docker is installed successfully:

Docker version

If the output looks at the version number of Docker, the installation is successful, and you can start the Docker service with the following command:

Service docker start

If the service command fails to start, use the following

Systemctl start docker.service

Download the image

Docker search

Use docker pull imagename (mirror name) to download the image

After the download is complete, use the following command to view all local images:

Docker images

When the download is complete, you should see:

REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEdocker.io/centos centos7 f753707788c5 12 days ago 127.1 MB

Start the container

The container runs on a mirror basis, and once the container is started, we can log in to the container and install the software or applications we need.

Use to enter docker that is already running

Docker attach dabfb413d8cf [Container ID]

Use the following command to start the container:

Docker run-I-t-v / root/software/:/mnt/software/-- privileged=true 2a392a47afc5

Docker run

The relevant parameters include:

-I: indicates that the container is running in interactive mode

-t: indicates that the container will enter its command line after startup

-v: indicates which local directory needs to be mounted to the container. Format-v:

Suppose all our installers are placed in the / root/software/ directory of the host, and now we need to mount them to the container's / mnt/software/ directory.

After reading the above, have you mastered how to install the docker container? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Tags: Container command image directory run success operating system content method more program system software problem helpless for this kernel reason parameter foundation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Shulou Tech Info Apple OPPO Reno NVidia