🐋 How I learn Docker 🐋

DevOps

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

  1. run
    • start a new container (always)
    • e.g. docker container run --publish 80:80 nginx
  2. start
    • start an existing stopped container
  3. stop
    • stop container

options: check operation in container

  1. top
    • list all running process in specific container
  2. inspect
    • details of one container config
  3. 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


profile image
Written by Lai Weng Han