April 10, 2021
go to https://docs.docker.com/get-started/
download version for your OS
docker version
This is will create a new contrainer and return its id
docker create hello-world
docker start -a ecfa027a48b2840d6ec8db4d14e558577bf3f6c06d5539090bdada3fd5ca8e29
Will print all of the logs when it is running
docker start -a ecfa027a48b2840d6ec8db4d14e558577bf3f6c06d5539090bdada3fd5ca8e29
Will only print the response
Run = Create + Start
docker run busybox echo hi there
Sends SIGTERM and waits till process stop before it stops container
docker create busybox ping google.com
docker start a2b4916bd95adfd7badc8db02f40cb1ab816e66be970a306771f5dee4c189af5
docker ps
docker stop a2b4916bd95a
Sends SIGKILL will shut down now and does not wait for processes to stop
docker create busybox ping google.com
docker start a2b4916bd95adfd7badc8db02f40cb1ab816e66be970a306771f5dee4c189af5
docker ps
docker kill a2b4916bd95a
This will delete stopped containers, cache, and images
docker system prune
docker ps
You are able to reuse container id to run it
docker ps --all
docker create busybox echo hi there
docker start 12122afb3886801718694ed0d32fc414cbcf051f330515f5c5690f5c6b00924
docker logs 12122afb3886801718694ed0d32fc414cbcf051f330515f5c5690f5c6b00924
docker run redis
docker ps
docker exec -it f82394b79b0d redis-cli
docker run redis
docker ps
docker exec -it f82394b79b0d sh
redis-sever