AsafsMacBook:~aahmadov$ dockerrunredis1:C28May202204:26:22.809# oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo1:C28May202204:26:22.809# Redis version=6.2.6, bits=64, commit=00000000, modified=0, pid=1, just started1:C 28 May 2022 04:26:22.809 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1:M28May202204:26:22.809*monotonicclock:POSIXclock_gettime1:M28May202204:26:22.811*Runningmode=standalone,port=6379.1:M28May202204:26:22.811# Server initialized1:M28May202204:26:22.812*Readytoacceptconnections
The docker ps command only shows running containers by default. To see all containers, use the -a (or --all) flag:
AsafsMacBook:~aahmadov$ dockerps-aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b7421b65d01a redis:4.0 "docker-entrypoint.s…" 6 minutes ago Up 6 minutes 6379/tcp quizzical_wilson
9e0452128f10 redis:latest "docker-entrypoint.s…" 6 minutes ago Up 6 minutes 6379/tcp strange_jones
98b3dd2527ac hello-world "/hello" 2 months ago Exited (0) 2 months ago gracious_shirley
1e606fd2c79b docker/getting-started "/docker-entrypoint.…" 2 months ago Created stoic_kilby
We use Docker detached mode (-d) when we want to connect to the container in an interactive mode or we can say when we just want application to be running inside the container. This means, we can start up the container and could use the console after startup for other commands.
It runs the container in the background of your terminal. It does not receive input or display output.
I will use pull command to download the Jenkins Image into the local Ubuntu server.
AsafsMacBook:~aahmadov$ dockerpulljenkins
To understand what ports are exposed by the container, we should use the Docker inspect command to inspect the image. This method allows one to return low-level information on the container or image.(JSON format)
AsafsMacBook:~aahmadov$ dockerinspectjenkins
To run Jenkins and map the ports, you need to change the Docker run command and add the ‘p’ option, which specifies the port mapping. So, I need to run the following command :