Connecting to a Docker Container Using Ubuntu Terminal

  • NOTE: You can do other commands such as copy files from the container to your VM, install tools in the container, and anything that can be done on a regular Ubuntu install. For more information, look in the DOCKER DOCUMENTATION.
  •  Assumptions
    • You are using Ubuntu/Debian-based OS
    • You have Docker installed
    • You have a running container
    • You have access to the docker environment
  • Get the docker ID and list the containers
    • Open Ubuntu Terminal
      • docker ps
        • This allows you to get a list of all docker containers
    • The docker ID is the first string of numbers and letters before your container
    • Enter the docker container
      • docker exec -it <your container ID> bash
        • docker exec -it 175cb158268e bash
  • You can now execute commands in the container just as you could in a regular Ubuntu Server.

Leave a Reply

Your email address will not be published. Required fields are marked *