본문 바로가기
IT라이프/Linux

Docker 기본 Command

by zairan 2021. 7. 7.

1. centOS를 받으면서 bash 실행하기

// centos:latest => OS:tag
$ docker run -it --rm centos:latest bash

2. linux 에 도커설치하기

// install curl
$ sudo apt-get curl

// install docker
$ curl -s https://get.docker.com | sudo sh

// docker 버전확인
$ docker -v
$ dpkg --get-selections | grep docker

3. Docker Command

// running docker 
$ docker ps
CONTAINER ID   IMAGE  COMMAND  CREATED  STATUS   PORTS   NAMES

$ docker ps -a


// image pull
$ docker pull ubuntu:bionic
$ docker images

// run container from image
$ docker run -it ubuntu:bionic bash

$ docker restart <CONTAINER ID>

// bash에 들어가서 여러가지 변경 후 이미지에 저장하기
$ docker commit <CONTAINER ID> ubuntu:mytag_name

// delete container 
$ docker rm 2a00b9b2b7cc

// delete image
// container를 rm한 후에 이미지 삭제가능
$ docker rmi ubuntu:mytag_name
반응형

'IT라이프 > Linux' 카테고리의 다른 글

Git merge 에 관한 고민  (0) 2022.10.25
zsh 파일 로딩 순서  (0) 2022.09.21
리눅스 커맨드파일 폴더 구조  (2) 2016.04.18
리눅스 설정파일 로딩순서 (bash_)  (0) 2016.04.18
SVN  (0) 2015.03.04

댓글