Learn how to access Docker containers in 116 seconds

By Lukas Aichbauer & Ivan Popovic | March 28, 2024 | 2 min watch

Lukas Aichbauer
Ivan Popovic

Description

Learn all the commands needed to access and interact with running Docker Containers in 116 seconds.

Learning outcomes

  • How do I access running Docker Containers?
  • How do I check logs of a running Docker Container?
  • How do I establish a persistent connection with my running Docker Container?
  • What commands do I need?
  • How do the commands work together?

Commands You Will Learn

docker logs <container-name/container-id> – list everything your container has written to the Standard Input, Standard Outpu or Standard Error(STDIN/STDOUT/STDERR).

docker exec <container-name/container-id> <command-to-be-executed-inside-the-container> – execute a command inside your container (e.g., docker exec 0099887 ls). Important to note here, is that, this command needs to be available in the container’s file system.

docker exec --tty --interactive <container-name/container-id> sh – create an interactive shell that is similar to an SSH connection to a server.