How to access CLI programs in a container even if not documented

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the docker category.

Last Updated: 2021-05-16

I wanted to manually inspect the mysql database in a docker container but there was no documentation about how to get into it.

It turned out to be there after all, thanks to the fact that most containers are based on some unix variant:

$ docker-compose -f docker-compose-development.yml -f docker-compose.yml exec mysql bash

From within this shell I could run $ mysql -u project_s -ppassword to get into the mysql client.


Docker - most every container has its own shell (often bash). If you want to access the specific cli program in that container, first log in to the bash.