How to show the run command of a docker container

前端 未结 11 1274
萌比男神i
萌比男神i 2020-11-27 10:24

I use a third party GUI (Synology Docker package) to setup a docker container. However, it\'s limitation makes me need to run the container from the command line. (I want to

11条回答
  •  爱一瞬间的悲伤
    2020-11-27 10:45

    So how to reverse engineering docker run command?

    There is a github repository which try to reverse engineering docker run command, but it is not perfect currently, version is 0.1.2. You should follow it for updating. Maybe one day you can use it to get correct run command with it.

    $ sudo pip install runlike
    
    # run the ubuntu image
    $ docker run -ti ubuntu bash
    
    $ docker ps -a  
    # suppose you get the container ID 1dfff2ba0226
    
    # Run runlike to get the docker run command. 
    $ runlike 1dfff2ba0226
    docker run --name=elated_cray -t ubuntu bash
    

    Github repository: runlike

    Updates:

    Run without installing (Thanks @tilo)

    docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
        assaflavie/runlike YOUR-CONTAINER
    

    or set alias

    alias runlike="docker run --rm -v/var/run/docker.sock:/var/run/docker.sock 
     assaflavie/runlike"
    
    runlike YOUR-CONTAINER
    

提交回复
热议问题