Docker and Podman Command Generator

Everyday docker and podman commands: shell, logs, exec, run, build, compose.

About this tool

Pick what you want to do, such as open a shell in a container, follow its logs, run a command, copy files, inspect it, build or clean up images, or drive Docker Compose, and get the exact docker or podman command with every flag explained. The run builder also turns a container into a Compose file, and pasted run commands can be imported and edited.

How to use it

  1. Choose Docker or Podman; the commands are the same apart from the program name.
  2. Pick a task on the left, like Open a shell, View logs or Clean up disk space.
  3. Fill in the container name and options. The name you type carries over to the other tasks.
  4. Copy the command and read what each part does. For Run a new container you can also get a Compose file.

Questions

How do I get a shell inside a running container?
Run docker exec -it CONTAINER sh. Use bash instead of sh if the image has it; slim and Alpine images usually only have sh. Type exit to leave without stopping the container.
How do I follow the logs of a container?
docker logs -f --tail 100 CONTAINER shows the last 100 lines and keeps streaming. Add --since 10m for recent lines only, and pipe through grep -i --line-buffered error to filter as lines arrive.
How do I turn a docker run command into docker compose?
Paste the command into the import box and switch the result to Compose file. Ports, volumes, environment variables, restart policy, network and resource limits are carried over.
What does -p 8080:80 mean?
The left number is the port on your machine and the right one is the port inside the container. Prefix it with 127.0.0.1: to make the port reachable only from your own computer.
What is the difference between a named volume and a bind mount?
A bind mount like ./data:/data maps a folder from your machine. A named volume like pgdata:/var/lib/postgresql/data is storage managed by Docker, which survives the container and is the usual choice for databases.
Are Docker and Podman commands the same?
Almost: podman run accepts the same flags. The main differences are rootless defaults, so host ports below 1024 need extra setup, and SELinux systems often need :Z on bind mounts.
Should I put passwords in -e flags?
They end up in your shell history and in docker inspect. For anything beyond local testing, use an --env-file kept out of version control, or your platform’s secrets feature.

Something not working, or a result looks wrong? Report a problem with this tool