Sign inSign up

cucker/get_command_4_run_container

By cucker

•Updated over 2 years ago

通过容器获取容器的docker run命令/get the docker run by a container.

Image
Developer tools
9

10K+

cucker/get_command_4_run_container repository overview

⁠get_container_run_command

⁠What's this

Get the docker run command by a container.

Include docker run options and arguments.

⁠Quick reference

⁠How to use this image

Usage:
# 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
    

Tag summary

Content type

Image

Digest

sha256:37175b728…

Size

27.6 MB

Last updated

over 2 years ago

docker pull cucker/get_command_4_run_container