Executing commands in a container.
On this page 1 section
Remote into a docker container
Information about Docker.
This command will execute you into a terminal session inside of the docker conatiner.
docker container exec -it containerID /bin/bash
Run this command instead to execute a command inside the docker conatiner. This will list the contents of the /var folder
docker container exec -it my_mysql ls /var
Accessing the container ID.
You can get the container ID by running;
sudo docker ps -a
This will show you all the containers (running or not) that are on the system you can use the container name (if you gave it one) or the container ID to run the above commands.