So you did run
docker run manually in your terminal. The container is running fine. But someday you do not remember which flags you have set and your terminal history is a mess to figure out the command. You might want to move over to
docker compose, which you should. But how?
You could use
docker inspect CONTAINER_ID in order to check ALL the flags and defaults have been set on the container. The list is just to long to quickly check. But there is a better and easier way:
You can use the
rekcod container to create a
docker run command from your running containers.
$ docker run --rm -i -v /var/run/docker.sock:/var/run/docker.sock nexdrew/rekcod <container-name/container-id>
This will give you an output like this:
docker run --name blog -v blog_ghost-data:/var/lib/ghost/content:rw --net blog --restart always --expose 2368/tcp -d
Super useful, especially when you are creating containers against the Docker API and can not use tools like
Most of the time it works great. However, it is not perfect. Sometimes you need to adjust the output slightly. Still better than going through the kilometer long
docker inspect output.
❤️That is it for today!❤️
Did you ever need something like this? I hope you remember this post in the future if you need to!
Have a great day!