docker mirror package

.NET CORE 3.0 to repackage an example join gdiplus

Mirror Package

1 Find a mirror

1 take the specified image from the pull dockerhub

docker pull [images]:[version]

Here, I use dockerfile pull of my order

FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim

2 View Mirror List

docker images

Mirroring is static, the mirror image id, 880d85db3775

2 modified container

1 mirrored up and running
background start docker, and specify the host port mapping and port docker.

8000 RUN -p Docker: 80-TDI --privileged [imagelD] [Command]
-i: interactive mode containers, generally used -t simultaneously;
-d: background container, and returns the container ID;
-t: is container reassign a pseudo input terminal, typically used in conjunction with -i;
--privileged container will have access to all host device permissions

Typically the [command] fill / bin / bash can.

In special cases, such as the need to use systemctl in centos mirror, and should add --privileged set [command] is init.

My command

docker run -p 9699:80 -tdi --privileged 880d85db3775 /bin/bash

View all containers 2 run in, get the container with id

docker ps -a

When activated by the mirror 3 RUN, it will be loaded into a dynamic Container (vessel) running at this time if desired terminal enters interactive mode:

sudo docker exec -it [containerID] /bin/bash

Interactive mode, use ctrl + p + q Quit interactive to keep running, use the exit command to exit and stop the container.

My orders, installation gdiplus in the docker, after exit interactive installation

sudo docker exec -it 12b89974bc2b /bin/bash
apt-get update && apt-get install -y libgdiplus libc6-dev && ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll

4 in the container non-interactive mode, start / stop container service deployed by the command.

docker start/stop

5 Remove the container

docker rm [containerID]

6 Remove Mirror

docker rmi [imageID]

7 the specified file in the specified address is transmitted to the host inside of the container

docker cp [YourHostFilePath] [containerID]:[DockerPath]

3 Create a new image

The container 1 after the re-packaged into a modified image

docker commit [containerID] [ImageName]:[Version]

My orders, and view the pack

docker commit 12b89974bc2b wscore3:v1
docker images

Save the container for the new image, and add author information and description information.

docker commit -a "ws" -m "wscore3v1" 12b89974bc2b wscore3:v1

Parameters
-a: Mirror of submission;
-c: Use Dockerfile command to create a mirror;
-m: Caption the time of filing;
-p: When commit, the container is suspended.

3 submitted mirrored to the cloud repository

docker push [ImageID] [repertory_address]

reference

Docker commonly used commands Daquan
.NET Core image manipulation pit under Linux / Docker's

Guess you like

Origin www.cnblogs.com/xcsn/p/12121421.html