티스토리 뷰

* 기본 명령어
-- 이미지 확인
docker images

-- 컨테이너 확인
docker ps -a

-- 컨테이너 삭제
docker rm [CONTAINER ID] or [NAMES]

-- 컨테이너 실행
docker start [CONTAINER ID] or [NAMES]

-- 컨테이너 재실행
docker restart [CONTAINER ID] or [NAMES]

-- 컨테이너 접속
docker exec [Options] [CONTAINER ID] /bin/bash
docker exec -it [CONTAINER ID] /bin/bash
 -i : 컨테이너 입출력 interactive 설정
 -t : 터미널 역할하는 tty 사용


* Build & Run
1. Docker Build
-- Create Docker Image
- Docker Image Name : centos7_apache_php
docker build -t centos7_apache_php .

2. Docker Run
# Basic
- Container Name : test-was 
- Docker Image Name : centos7_apache_php
docker run -d -p 80:80 --name kairspec-was centos7_apache_php

# Share Directory ( Mount Volumn )
- Container Name : test-was 
- Docker Image Name : centos7_apache_php
- Mount Directory : [path]:/home/laravel
docker run -v [path]:/home/laravel -d -p 80:80 --name test-was centos7_apache_php

 

댓글