🐋 How I learn Docker 🐋
Docker 🐳
Setting up Docker
Recently, I just try out docker to seek for alternative for AWS. It turns out it was a pleasant changes I have made.
Day 1: Learning container
What is container?
Container is an instance of the image running as a process.
What is image?
Image is an application that we want to run. Image can be run by many containers.
docker container <subcommand> (options)
a basic command to use in docker
<subcommand>
options: standard operation
run
- start a new container (always)
- e.g.
docker container run --publish 80:80 nginx
start
- start an existing stopped container
stop
- stop container
options: check operation in container
top
- list all running process in specific container
inspect
- details of one container config
stats
- performance stats for all container
options: Getting a shell into container
With Docker cli, there is no need to use SSH , because with pseudo-tty (-t
) we are able to simulate a real terminal. -i
simply means interactive, allow the terminal to on as always.
1. run -it
- start new container interactively
2. exec -it
- run additional command in existing container
3. exit
- to exit
