Linux distributions (Linux distros)

Linux is an open-source: There’s lot of variations according to their usage

Install ubuntu

Shortcut: $ docker pull ubuntu → $ docker run ubuntu

run automatically download and run image if not already downloaded from docker hub.

$ docker ps shows only running containers, while $ docker ps -a shows stopped containers as well.

Start a container and iteract with it

$ docker run -it ubuntu opens a shell

root@ccbf220836a0:/#
root: user id
ccbf220836a0: machine id
/: current directory
#: Show highest privileges in linux since we logged in as a root

root@ccbf220836a0:/# echo hello
hello
root@ccbf220836a0:/# whoami
root
root@ccbf220836a0:/# echo $0
/bin/bash  # Show location of the shell program
root@ccbf220836a0:/#

Linux is case-sensitive system → Echo $0 will not work

Managing packages

Package managers

May have tones of packages in this database, but not all of them are installed.

# apt install vim
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package vim

# apt list to see all the packages

# apt update to update package DB (Before installing package, always update package DB)

# apt -y install vim to install vim from updated package DB. (-y to yes to confirmation)

Linux file system

Hierarchical system

→ In Linux, everything is a file including directories, devices, processes.

Windows


도커에 우분투 20.04 이미지 인스톨

$ docker run  -d -t --name ubuntu ubuntu:20.04

컨테이너 시작

$ docker exec -it ubuntu bash

컨테이너 버전 확인

$ cat /etc/os-release

실행중인 컨테이너 확인

$ docker ps

컨테이너 스톱

$ docker stop [container_id]

멈췄거나 삭제된 컨테이너 확인

$ docker ps -a

컨테이너 삭제

$ docker rm [container_id1] [container_id2]

현재 설치된 이미지 확인

$ docker images

이미지 삭제

$ docker rmi [img_id]

컨테이너 지우고 이미지 삭제

$ docker rmi -f [img_id]