Running images as containers
In this section, we will look at running Docker images as containers and examine the different information that we can see when a container is running.
Start by running a database Docker image and look at what information we can get about the state of the container. Open the terminal window and run the following command to run Redis locally. Redis is an open source memory-based data store used to store data. Since data is stored in memory, it is fast compared to storing on disk. The command will run Redis, listening on port 7777
:
docker run -p 7777:7777 -v /home/user/Downloads/redis-7.0-rc3/data:/data redis --port 7777
Make sure you change the /home/user/Downloads/redis-7.0-rc3/data
directory to your own local directory, as Docker will use this to store the Redis data file.
You will see the following message when the container is up and running:
1:C 05 May 2022 11:20:08.723 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 1:C 05...