Shelling into a container managed by Compose
Since we’ve been successful in running a Redis database using Compose, we will run some commands upon that Redis instance and get familiar with the database. As happens with many container-based distributions of databases, along with the actual database, the image can contain tools that help the user interact with the database for administrative or usage purposes.
The Redis CLI can be used to send commands to a Redis service. The Redis Docker image does contain the Redis CLI, so we should be able to use it with the running database.
Let’s find our running Redis image:
$ docker ps --format "{{.Names}}" chapter2-redis-1 $
Let’s shell into this image:
$ docker exec -it chapter2-redis-1 bash root@d189b089bcf6:/data#
We just shelled successfully into a container managed by Compose. Let’s navigate and see what is already there:
$ root@d189b089bcf6:/data# ls dump.rdb root@d189b089bcf6...