Learn How To Access Docker Containers In 116 Seconds

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

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-nam/container-id> – list everything your container has written to the STDIN/STDOUT/STDERR

docker exec <container-nam/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-nam/container-id> sh – create an interactive shell that is similar to an SSH connection to a server.