Create a container from an existing image

background

I want to compile a set of keepalived for the CPU on the arm architecture. The existing condition is that there is a set of arm CPU on which centos7 has been installed. In order not to affect the environment of the own system, I want to create a container to isolate the environment. The existing environment It is arm+centos7+docker, create a centos7 container on it, and compile keepalived in this container

operate

View existing mirrors

docker images

It can be seen that there is already a centos7 image in my environment

create container

docker run -it --name keepalived --network=host -v /home/keepalived:/home/keepalivd -d centos:centos7

Parameter explanation and function

Parameters: --network=host,

Function: Using the host network and host mode, the container will not virtualize its own network card, configure its own IP, etc., but use the host's IP and port

Parameters: -v 

Function: Mount the host directory, associate folders inside and outside the container, and realize data synchronization (file synchronization, two-way binding, container data volume persistence).

1. The data can still be kept in the external folder after the container is deleted;

2. Transfer data to the container without entering the container

Parameters: -d

Role: running in the background

Guess you like

Origin blog.csdn.net/u011285281/article/details/129184170