Skip to main content

[Docker] Docker commonly used commands

[Docker] Docker commonly used commands

[Docker] Docker commonly used commands

Table of contents

1. Mirror warehouse architecture diagram

2. docker warehouse command

1. Log in to the warehouse docker login

2. Pull the image docker pull

3. Push the image docker push

4. Find the image docker search

5. Log out of the warehouse docker logout

3. docker image command

1. List local image docker images

2. View image details docker image inspect

3. Mark the local image and classify it into a certain warehouse docker tag

4. Delete the image docker rmi/delete the container docker rm

5. Package the specified image into a tar file docker save

6. Restore the tar package of docker save back to docker load

7. Display image history docker history

8. Delete unused images docker image prune

4. Container commands

1. Create a new container and run a command docker run/Create a new container but do not run docker create (the command is the same as docker run, docker run has an additional -d option)

-i, -t, -d options: -it is used together with -d to run in the background.

-p option: specify port mapping

--name option: Give the container a name when it starts

--cpuset-cpus="0-2" or --cpuset-cpus="0,1,2": Bind the container to the specified CPU to run

-m: Set the maximum memory used by the container (example is 500m)

--link=[]: Add a link to another container so that the two containers can access each other

--rm :shell automatically deletes the container when exiting

2. List containers docker ps

3. View container logs docker logs

4. Connect the current terminal to the standard input, output and error of a running Docker container docker attach

5. Execute the command docker exec in the container

6. Restart the stopped container docker start/stop the running container docker stop

7. Restart the container docker restart

8. Force exit from the container docker kill

9. View the process information running in the container docker top

10. Display container resource usage docker stats

11. View container details docker container inspect

12. View the docker port mapped externally by the specified container

13. Copy files between the container and the host docker cp

14. Check for changes in the file structure in the container docker diff

15. Create a new custom image from the container docker commit

16. Pause/unpause all processes in the container docker pause/docker unpause

17. Export the container content as a tar package docker export/restore the exported tar package to a mirror docker import

18. Block the running until the container stops and print the exit code docker wait

19. Container rename docker rename

20. Delete all stopped containers docker container prune

21. Update container configuration docker update

5. nginx

6. busybox


1. Mirror warehouse architecture diagram

[Docker] Docker commonly used commands

Mirror warehouse: a warehouse that stores images. Each mirror warehouse contains multiple tags.

tag: Each tag corresponds to an image

2. docker warehouse command

docker guide: Docker Docs

Docker official warehouse: https://hub.docker.com/

OrderAliasFunction
docker loginLog in to the warehouse
docker pulldocker image pullPull image
docker pushdocker image pushPush image
docker searchFind an image
docker logoutLog out of warehouse

1. Log in to the warehouse docker login

     sudo docker login

sudo docker login -u jianglingyu



2. Pull the image docker pull

Pull or update the specified image from the image warehouse

     sudo docker pull nginx:1.23.4-perl

sudo docker pull nginx@sha256:55ef01aae23f582e98d9e91075caa0c96d9c2f2754d24cb0f2be5ca26620a212



[Docker] Docker commonly used commands

3. Push the image docker push

[Docker] Docker commonly used commands

[Docker] Docker commonly used commands

[Docker] Docker commonly used commands

     # Change a tag first

sudo docker tag nginx:1.23.4-perl jianglingyu/test_repository:666

sudo docker push jianglingyu/test_repository:666



Usually go to the hub.docker.com website to find it, and less often use commands.

     sudo docker search nginx

# Find nginx with a star count greater than 10

sudo docker search -f stars=10 nginx



5. Log out of the repository docker logout

 
sudo docker logout

3. docker image commands

1. List local images docker images

     sudo docker images

# Find images with nginx associated with them

sudo docker images nginx

sudo docker images nginx:1.23.4-perl # You have to type everything after the colon.

# Show sha256 digest information along with it

sudo docker images --digests

# -f is to filter for images created before jianglingyu/test_repository:666

sudo docker images -f before=jianglingyu/test_repository:666



[Docker] Docker commonly used commands

2. View image details docker image inspect

 
sudo docker image inspect jianglingyu/test_repository:666

[Docker] Docker commonly used commands

For example, to start the nginx container, you can use this command to view the nginx startup method (Cmd field) and ports (ExposedPorts field)

3. Tag local images to a repository docker tag

Use with docker push

     sudo docker tag nginx:1.23.4-perl jianglingyu/test_repository:666

# Or use image id for tagging

sudo docker tag 15578d966674 jianglingyu/test_repository:666

# Push

sudo docker push jianglingyu/test_repository:666



4. Delete image docker rmi/delete container docker rm

     sudo docker rmi hub.c.163.com/library/tomcat:latest

sudo docker rmi -f hub.c.163.com/library/tomcat:latest # force delete

# Delete the image when a reference exists

[jly@VM-4-6-centos ~]$ sudo docker rmi hello-world:latest

Error response from daemon: conflict: unable to remove repository reference "hello-world:latest" (must force) - container 2e4b11735cb5 is using its referenced image d2c94e258dcb

[jly@VM-4-6-centos ~]$ sudo docker rm 2e4b11735cb5 # remove container

2e4b11735cb5

[jly@VM-4-6-centos ~]$ sudo docker rmi hello-world:latest

Untagged: hello-world:latest

Untagged: hello-world@sha256:4bd78111b6914a99dbc560e6a20eab57ff6655aea4a80c50b0c5491968cbc2e6

Deleted: sha256:d2c94e258dcb3c5ac2798d32e1249e42ef01cba4841c2234249495f87264ac5a

Deleted: sha256:ac28800ec8bb38d5c35b49d45a6ac4777544941199075dff8c4eb63e093aa81e



5. Pack the specified image into a tar file docker save

     # Packaged in a tar

[jly@VM-4-6-centos busybox]$ sudo docker save -o busybox.tar busybox:1.36

[jly@VM-4-6-centos busybox]$ ls

busybox.tar

# Pack multiple mirrors together into a tar

[jly@VM-4-6-centos busybox]$ sudo docker save -o busyboxs.tar busybox:1.36 ccr.ccs.tencentyun.com/jianglingyu/my_busybox:V1.1

[jly@VM-4-6-centos busybox]$ ls

busyboxs.tar busybox.tar



6. Restore the tarball from docker save back to docker load

 
sudo docker load -i busyboxs.tar -q # -q to streamline information, no q to show restore progress

Transferring a file between two servers via ssh scp myfile root@xxx.xxx.xxx.xxx:/filepath

7. Show image history docker history

docker history displays information about the creator, creation time, and size of each layer.

     [jly@VM-4-6-centos busybox]$ sudo docker history busybox:1.36 

IMAGE CREATED CREATED BY SIZE COMMENT

3f57d9401f8d 2 weeks ago CMD ["sh"] 0B buildkit.dockerfile.v0

2 weeks ago ADD busybox.tar.xz / # buildkit 4.26MB buildkit.dockerfile.v0



8. Remove unused images docker image prune

     [jly@VM-4-6-centos busybox]$ sudo docker image prune 

WARNING! This will remove all dangling images.

Are you sure you want to continue? [y/N] y

Total reclaimed space: 0B



You can also add the -a option, which will clean up all unused images.

The docker image prune command removes the following types of images

  1. dangling images: These are images that are not associated with any container, may be middle-tier images from a previous build, or may not be labeled properly for some reason.
  2. unused local images: If an image is not used by any container, it is considered unused.

The purpose of this command is to clean up the system of mirrors that are no longer needed to save disk space. Before using it, you need to make sure that no important images will be deleted as this command is irreversible.

The difference between this command and docker rmi is that docker rmi prefers to delete an image manually.

4. Container commands

1. Create a new container and run a command docker run/create a new container but do not run docker create (the command is the same as docker run, docker run has an extra -d option).

[Docker] Docker commonly used commands

○ **-d: ** Runs the container in the background and returns the container ID;

○ **-i: ** Runs the container in interactive mode, usually used with -t;

○ **-p: ** random port mapping, where the container's internal ports are randomly mapped to the host's ports

-p: Specifies a port mapping in the format: ** host ( host ) port : container port **

-t: Reassigns a pseudo input terminal to the container, usually used in conjunction with -i;

○ **--name="nginx-lb" : ** Specify a name for the container;

○ **-h "mars" : ** Specify a hostname for the container;

○ **-e username="ritchie" : ** Set the environment variable;

○ **-cpuset-cpus="0-2" or --cpuset-cpus="0,1,2" : ** Bind the container to run on the specified CPU;

-m : Sets the maximum value of memory used by the container;

○ **--network="bridge" : ** Specify the type of network connection for the container;

○ **--link=[] : ** Add a link to another container;

○ **--volume , -v : **Bind a volume.

○ **--rm **:Automatically delete containers when shell exits

-i, -t, -d options: -it to use with, -d to run in background

     sudo docker ps # View currently running containers

sudo docker ps -a # Previously running or created containers that are not running

sudo docker pull centos:7 # Pull the image

sudo docker run centos:7 # Run the centos7 container, executing the default startup command (/bin/bash, which will just quit)

sudo docker run -it centos:7 bash # Start a centos7 interactive Bash terminal i:Interactive mode running terminal, reassign a pseudo-entry terminal to the container

sudo docker run nginx:1.23.4-perl # Run nginx in the foreground (without exiting) and execute the default startup command (start nginx)

sudo docker run -d nginx:1.23.4-perl # Run nginx in the background



-p option: specify port mapping

     [jly@VM-4-6-centos nginx]$ sudo docker run -d -p 8050:80 nginx:1.23.4-perl

71400b8910d6a5aeabc81e68c83d4e4b2c01e256364bf68933f640ca1762ba87



If the port is not mapped with -p: sudo docker run -d nginx:1.23.4-perl, external browsers will not be able to access the container's nginx port.

Of course you can also use sudo docker run -d -P nginx:1.23.4-perl to randomly map the port sudo docker ps to see the randomly assigned port.

--name option: give the container a name when it starts up

 
sudo docker run --name myNginx nginx:1.23.4-perl

-cpuset-cpus="0-2" or --cpuset-cpus="0,1,2": Bind the container to run on the specified CPU.

[Docker] Docker commonly used commands

     [jly@VM-4-6-centos ~]$ sudo docker run -d --name myNginx --cpuset-cpus="0-9" nginx:1.23.4-perl

docker: Error response from daemon: Requested CPUs are not available - requested 0-9, available: 0-1.

See 'docker run --help'. # Available cores 0-1



[jly@VM-4-6-centos ~]$ sudo docker run -d --name MyNginx --cpuset-cpus="0-1" nginx:1.23.4-perl

c5720d9ba305e8e48d59653d926d2993315e2a389c831e8e3455361b5b8bffd9



-m :Set the maximum amount of memory to be used by the container (example is 500m)

     [jly@VM-4-6-centos ~]$ sudo docker run -d --name MyNginx1 -m 500m nginx:1.23.4-perl

89c9282f55bee6f4d3d83a7bd4827bac1677849ed32c2d40b190fb8d9a8eb2db



     # Run the centos7 container

[jly@VM-4-6-centos ~]$ sudo docker run -it --name MyCentOS7 centos:7 bash

[root@32fc6c8c5808 /]#

# Run the second centos7 container and rename the linked container

[jly@VM-4-6-centos ~]$ sudo docker run -it --name MyCentOS7_1 --link MyCentOS7:changeName centos:7 bash

# The second container pinged the first container and it pinged through.

[root@6bf58364ef6e /]# ping changeName

PING changeName (172.17.0.4) 56(84) bytes of data. 64 bytes from changeName (172.17.0.5)

64 bytes from changeName (172.17.0.4): icmp_seq=1 ttl=64 time=0.101 ms

64 bytes from changeName (172.17.0.4): icmp_seq=2 ttl=64 time=0.050 ms

64 bytes from changeName (172.17.0.4): icmp_seq=3 ttl=64 time=0.053 ms

# First container pinging second container, ping doesn't work (because the first container was created without the --link link)

[root@32fc6c8c5808 /]# ping MyCentOS7_1

ping: MyCentOS7_1: Name or service not known

# Check the /etc/hosts directory of both containers and just add ip to this file

First:

[root@32fc6c8c5808 /]# cat /etc/hosts

127.0.0.1 localhost

::1 localhost ip6-localhost ip6-loopback

fe00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

172.17.0.4 32fc6c8c5808

Second:

[root@6bf58364ef6e /]# cat /etc/hosts

127.0.0.1 localhost

::1 localhost ip6-localhost ip6-loopback

fe00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

172.17.0.4 changeName 32fc6c8c5808 MyCentOS7 # save ip of first container

172.17.0.5 6bf58364ef6e # own ip



--rm :shell automatically deletes the container when it exits

With --rm, exiting doesn't leave a record:

     [jly@VM-4-6-centos ~]$ sudo docker run -it --name MyCentOS7_2 --rm centos:7

[root@da44dd4bf0e1 /]# exit

exit

[jly@VM-4-6-centos ~]$ sudo docker ps -a

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

6bf58364ef6e centos:7 "bash" 3 hours ago Exited (127) 3 hours ago MyCentOS7_1

32fc6c8c5808 centos:7 "bash" 3 hours ago Exited (127) 2 hours ago MyCentOS7

89c9282f55be nginx:1.23.4-perl "/docker-entrypoint.…" 3 hours ago Exited (0) 32 minutes ago MyNginx1

c5720d9ba305 nginx:1.23.4-perl "/docker-entrypoint.…" 3 hours ago Up 3 hours 80/tcp MyNginx



2. List containers docker ps

     sudo docker ps 

sudo docker ps -a # containers that have been run before or have been created without being run

sudo docker ps -as # s:show size



3. View container logs docker logs

     # Start an nginx

[jly@VM-4-6-centos ~]$ sudo docker run -d -p 8051:80 --name myNginx nginx:1.23.4-perl

e965415b65e7d0a02be0ec0ce0c640f7828113520b3ead38a5ac9c7b284c7bcd

# direct docker logs to view logs

[jly@VM-4-6-centos ~]$ sudo docker logs myNginx

/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration

/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/

/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh

10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf

10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf

/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh

/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh

/docker-entrypoint.sh: Configuration complete; ready for start up

2024/02/17 15:41:24 [notice] 1#1: using the "epoll" event method

2024/02/17 15:41:24 [notice] 1#1: nginx/1.23.4

2024/02/17 15:41:24 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6)

2024/02/17 15:41:24 [notice] 1#1: OS: Linux 3.10.0-1160.71.1.el7.x86_64

......

# Add a -f for continuous output (refreshing the nginx home page will continuously output the log)

[jly@VM-4-6-centos ~]$ sudo docker logs -f myNginx

# Print the first 5 most recent logs

[jly@VM-4-6-centos ~]$ sudo docker logs -f -n 5 myNginx



4. Connect the current terminal to the standard inputs, outputs, and errors of one of the running Docker containers docker attach

Key parameters:

--sig-proxy: whether to proxy all signals, default is true (exit will cause the container to exit), if set to false, it will not affect the container.

! [Docker] Docker commonly used commands

Connecting to a container will take over the standard inputs, standard outputs, and standard errors of that container, so as soon as the web end is refreshed, the terminal immediately receives the relevant log messages. If ctrl+c is pressed, the container will exit:

! [Docker] Docker commonly used commands

If you don't want to exit the container on exit, you need to add --sig-proxy=false to proxy the signal:

 
[jly@VM-4-6-centos ~]$ sudo docker attach --sig-proxy=false myNginx

5. Execute the command docker exec in the container

-d: Split mode, running in the background;

-i: Runs the container in interactive mode, usually used together with -t;

○ **-t: ** Reassigns a pseudo-input terminal to the container, usually used in conjunction with -i;

○ **-e: ** Set environment variables;

-u/--user: assigns a user to execute the command

-w/--workdir: Specify the work directory

     # Enter the container and enter the command

[jly@VM-4-6-centos ~]$ sudo docker exec -it myNginx bash

root@e965415b65e7:/# curl 127.0.0.1 # Access localhost via HTTP request




......

# Continuously enter commands in the container

root@e965415b65e7:/# nginx -v

nginx version: nginx/1.23.4

# Type exit to exit

root@e965415b65e7:/# exit

root@e965415b65e7:/# exit

[jly@VM-4-6-centos ~]$



# Either way you can enter a single command in the container

[jly@VM-4-6-centos ~]$ sudo docker exec myNginx nginx -v

nginx version: nginx/1.23.4

[jly@VM-4-6-centos ~]$ sudo docker exec -it myNginx nginx -v

nginx version: nginx/1.23.4



6. Restart the stopped container docker start/stop the running container docker stop

     [jly@VM-4-6-centos ~]$ sudo docker stop myNginx

myNginx

[jly@VM-4-6-centos ~]$ sudo docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

[jly@VM-4-6-centos ~]$ sudo docker start myNginx

myNginx

[jly@VM-4-6-centos ~]$ sudo docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

e965415b65e7 nginx:1.23.4-perl "/docker-entrypoint.…" 23 hours ago Up 7 seconds 0.0.0.0:8051->80/tcp, :::8051->80/tcp myNginx



7. Restart the container docker restart

It can restart running, stopped or even exited containers.

     # Restart gracefully and give the container time to aftermath resources

[jly@VM-4-6-centos ~]$ sudo docker restart MyCentOS7

MyCentOS7

# Ungraceful reboot, no matter if the container is running or not, send a kill -9 to kill it and reboot again

[jly@VM-4-6-centos ~]$ sudo docker restart -s -9 MyCentOS7

MyCentOS7



8. Force exit from the container docker kill

Docker stop sends a gentle SIGTERM signal, and docker kill sends a violent SIGKILL signal.

 
sudo docker kill

9. View the process information running in the container docker top

For example, some containers such as Nginx do not have the ps command. To view the process information of the container, you need to use docker top.

     [jly@VM-4-6-centos ~]$ sudo docker top myNginx

[jly@VM-4-6-centos ~]$ sudo docker stats



10. Display container resource usage docker stats

     [jly@VM-4-6-centos ~]$ sudo docker stats # real-time refresh

[jly@VM-4-6-centos ~]$ sudo docker stats myNginx # Live refresh

[jly@VM-4-6-centos ~]$ sudo docker stats -a # prints out even stopped containers, not helpful

[jly@VM-4-6-centos ~]$ sudo docker stats --no-stream # Snapshot form

CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS

e965415b65e7 myNginx 0.00% 2.336MiB / 1.952GiB 0.12% 28.5kB / 21.4kB 3.11MB / 0B 3



11. View container details docker container inspect

     [jly@VM-4-6-centos ~]$ sudo docker container inspect myNginx

[

{

"Id": "e965415b65e7d0a02be0ec0ce0c640f7828113520b3ead38a5ac9c7b284c7bcd",

"Created": "2024-02-17T15:41:20.359522338Z",

"Path": "/docker-entrypoint.sh",

"Args": [

"nginx",

"-g",

"daemon off;"

],

"State": {

"Status": "running",

......



12. View the docker port mapped externally by the specified container

     [jly@VM-4-6-centos ~]$ sudo docker port myNginx

80/tcp -> 0.0.0.0:8051

80/tcp -> [::]:8051



13. Copy files between the container and the host docker cp

     # Copy the file /usr/share/nginx/html/index.html from the container myNginx to the current directory of the host.

[jly@VM-4-6-centos ~]$ sudo docker cp myNginx:/usr/share/nginx/html/index.html .

Successfully copied 2.56kB to /home/jly/.



14. Check for changes in the file structure in the container docker diff

C: modified; A: added; D: deleted

     [jly@VM-4-6-centos ~]$ sudo docker diff myNginx

C /etc

C /etc/nginx

C /etc/nginx/conf.d

C /etc/nginx/conf.d/default.conf

C /run

A /run/nginx.pid

C /var

C /var/cache

C /var/cache/nginx

A /var/cache/nginx/uwsgi_temp

A /var/cache/nginx/client_temp

A /var/cache/nginx/fastcgi_temp

A /var/cache/nginx/proxy_temp

A /var/cache/nginx/scgi_temp

C /root

A /root/.bash_history



15. Create a new custom image from the container docker commit

-a: The submitted image author; ****

-c: Use Dockerfile instructions to create an image, and you can modify the startup instructions; ****

○**-m: ** Description text when submitting;

-p: Pause the container when committing.

     # View currently running images

[jly@VM-4-6-centos ~]$ sudo docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

e965415b65e7 nginx:1.23.4-perl "/docker-entrypoint...." 47 hours ago Up 21 minutes 0.0.0.0:8051->80/tcp, :::8051->80/tcp myNginx

# Create a new image myNginx my_new_nginx from running container myNginx

[jly@VM-4-6-centos ~]$ sudo docker commit myNginx my_new_nginx:v1.0

sha256:fa1552088c2d80faee9436b80ccf5927c14b8a7995f88a5c69d5301540b395c5

# with parameters

sudo docker commit -a 'jianglingyu' -m 'add files' -c 'CMD ["tail", "-f", "/etc/hosts"]' -p myNginx my_new_nginx:v2.0



Each time you commit, the generated image will save some modifications to the current container.

16. Pause/unpause all processes in the container docker pause/docker unpause

Pauses a container process by depriving it of its time slice.

[Docker] Docker commonly used commands

     # pause

[jly@VM-4-6-centos ~]$ sudo docker pause myNginx

myNginx

# Unpause

[jly@VM-4-6-centos ~]$ sudo docker unpause myNginx

myNginx



17. Export the container content as a tar package docker export/restore the exported tar package to a mirror docker import

The docker export command only exports the container's file system and does not include the container's metadata (such as labels, port mappings, volumes, etc.) or the container's running status. If you need this information when restoring, use docker save/docker load to save the restore.

     # Packaging the container

[jly@VM-4-6-centos ~]$ sudo docker export -o myNginx.tar myNginx

# Restore the exported package as an image

[jly@VM-4-6-centos ~]$ sudo docker import myNginx.tar myNginxImpoet:v1.0

# -c Modify the image's startup command -m Descriptive information

[jly@VM-4-6-centos ~]$ sudo docker import -c 'CMD ["nginx", "-g", "daemon off;"]' -m 'new commit' myNginx.tar myNginxImpoet:v1.0



18. Block the running until the container stops and print the exit code docker wait

     # docker wait container, after being killed, exit code 137

[jly@VM-4-6-centos ~]$ sudo docker wait myNginx1

137

# Kill the container

[jly@VM-4-6-centos ~]$ sudo docker kill myNginx1

myNginx



19. Container rename docker rename

 
[jly@VM-4-6-centos ~]$ sudo docker rename myNginx myNginx1

20. Delete all stopped containers docker container prune

 
[jly@VM-4-6-centos ~]$ sudo docker container prune

21. Update container configuration docker update

○**--cpus: ** number of cpu;

○**--cpuset-cpus: ** Which CPUs to use;

-m/--memory: memory limit;

--memory-swap: swap memory;

--cpu-period: Used to specify how often the container’s use of the CPU should be reallocated; ****

--cpu-quota: Used to specify the maximum amount of time this container can be run during this cycle. ****

     # Update container memory limit to 500m

[jly@VM-4-6-centos ~]$ sudo docker update --memory 500m --memory-swap -1 myNginx

myNginx



5. nginx

     sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

# Flush the local repository metadata cache

yum makecache

sudo yum install nginx -y

# Start nginx, enter the server IP address in your browser to see the home page

sudo nginx



[Docker] Docker commonly used commands

6. busybox

Command installation:

     # centos download busybox

[jly@VM-4-6-centos busybox]$ wget https://busybox.net/downloads/binaries/1.28.1-defconfig-multiarch/busybox-x86_64 --no-check- certificat

# Add executable permissions

[jly@VM-4-6-centos busybox]$ chmod +x busybox

# Use busybox

[jly@VM-4-6-centos busybox]$ . /busybox ls

busybox



Install using docker:

     # Download the docker image

sudo docker pull busybox:1.36

# Tagging

sudo docker tag busybox:1.36 jianglingyu/busybox:v1.0

# Login

sudo docker login

# push the image to your own repository-a means push all of them

sudo docker push jianglingyu/busybox:v1.0 -a