#1. Using Docker Attach
You can get bash shell access in your docker container with attach command. But your docker container must be started with /bin/bash. Use below syntax to get shell access of docker container. For example, your docker container is running with id 76debad837d2 and name happy_tecadmin. Use one of the following commands with attach method. Using Container ID: Using Container Name:
#2. Using Docker Exec
If docker container was not started with /bin/bash command. Then you can’t use attach command. Now, you need to use exec command to create bash in your container. Make sure you are using Docker version >= 1.3. Use below syntax to get shell access of docker container. For example, your docker container is running with id 76debad837d2 and name happy_tecadmin. Use one of the following commands with exec method. Using Container ID: Using Container Name: