通过容器获取容器的docker run命令/get the docker run by a container.
10K+
Get the docker run command by a container.
Include docker run options and arguments.
Dockerfile linksUsage:
# Command alias
echo "alias get_run_command='docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock cucker/get_command_4_run_container'" >> ~/.bashrc
. ~/.bashrc
# Excute command
## For all runing containers
get_run_command {allrun}
## For all containers include shutdown
get_run_command {all}
## For one or more containers
get_run_command <CONTAINER> [CONTAINER...]
<CONTAINER> // The container id or container name
Show help
docker run --rm cucker/get_command_4_run_container --help
# or
docker run --rm cucker/get_command_4_run_container
For example
## run a container for mysql
docker run -d --name mysql01 --restart=always -p 13306:3306/tcp --env MYSQL_ROOT_PASSWORD=py123456 mysql
## Command alias
echo "alias get_run_command='docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock cucker/get_command_4_run_container'" >> ~/.bashrc
. ~/.bashrc
## Excute command
get_run_command mysql01
# Output results
docker run -d \
--name mysql01 \
--env MYSQL_ROOT_PASSWORD=py123456 \
-p 13306:3306/tcp \
--restart=always \
mysql
Content type
Image
Digest
sha256:37175b728…
Size
27.6 MB
Last updated
over 2 years ago
docker pull cucker/get_command_4_run_container