Find out complete ‘docker run’ options of a running container

Aug 06, 2018


Sometimes we see a running container and we wonder how it is created and started, and if we know it we can run a same container to test, or slightly modify some options to suit other circumstances.

Can we know the complete options from the running container itself instead of checking the source of your colleagues or original authors? Refer to this post,there is a project mentioned to fulfill this need!


$ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock assaflavie/runlike <CONTAINER_ID>

The following example is a standard Centos container with systemd enabled:

$ docker run --name test --hostname test --privileged -d sdhuang32/c7-systemd

$ docker ps | grep test
3f90ddfa39f9        sdhuang32/c7-systemd       "/usr/sbin/init"         35 seconds ago      Up 30 seconds                                       test

$ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock assaflavie/runlike 3f90ddfa39f9
docker run --name=test --hostname=test --env="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" --env="container=docker" --volume="/sys/fs/cgroup" --privileged --restart=no --label org.label-schema.schema-version="1.0" --label org.label-schema.license="GPLv2" --label org.label-schema.vendor="CentOS" --label"20181205" --label"CentOS Base Image" --detach=true sdhuang32/c7-systemd /usr/sbin/init

Leave a comment