Develop Intelligence - Docker Creating Custom Docker Images: Sandeepsoni/helloworld:v2
Develop Intelligence - Docker Creating Custom Docker Images: Sandeepsoni/helloworld:v2
Docker command for not removing intermediate containers while building an image using Dockerfile
docker build -t helloworld --no-cache .
//no-cache ensures that each instruction is executed and docker cache is not used.
Docker DIFF:
We can use the following command to find the difference to filesystem the dockerfile command has caused to an
image
docker diff <container id>
• A = added
• C = changed
• D = deleted
Docker TOP:
• To see the the running processes for a container, you can do this directly without logging in to an interactive
shell on a container.
docker top <container>
Docker STATS
• Useful to see what Docker processes are running on the HOST and what their resource usage is.
• Works much like the top Linux command.
docker stats <container Id>
Docker CP:
• Allows you to copy files to/from a Docker container to/from the host computer.
• Format is:
• docker cp <container name>:<path> <host path>
• docker cp <host path> <container name>:<path>
Docker KILL
Develop Intelligence – Docker Creating Custom Docker Images
• Unlike docker stop, which will attempt to stop a container process gracefully, docker kill will send a SIGKILL
signal to the container’s running process.
• This is a bit more brute force.
• Typically this isn’t needed, as a docker stop will send a SIGKILL automatically if it doesn’t shut down gracefully.
We can execute following command to note all the sequence of steps performed when a docker command is
executed.
docker events --format "{{json .}}" //Execute this in a new command prompt
Restart Policy
docker run --restart unless-stopped redis
MSSQL Server
Develop Intelligence – Docker Creating Custom Docker Images
docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=Password_*123" --name "sql-demo" -e
"MSSQL_PID=Developer" -d -p 1412:1433 -v db-data-sqlsrv:/var/opt/mssql mcr.microsoft.com/mssql/server:2019-
latest
MySQL Server
docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=Password_*123 -d -p 3306:3306 -v db-data-
mysql:/var/lib/mysql mysql:latest