생활/컴퓨터
CentOS7 docker 설치
건강코더
2017. 5. 22. 13:26
1. docker 설치
[root@localhost ~]# yum -y install docker
2. CentOS 공식 이미지 파일 다운로드
[root@localhost ~]# docker pull centos
* 설치된 이미지 확인
[root@localhost ~]# docker images
3. 컨테이너에서 echo 실행
[root@localhost ~]# docker run centos /bin/echo "Welcome to the Docker World"
Welcom to the Docker World
4. 컨테이너 생성(i 옵션은 STDIN과 관련된 -t 옵션은 TTY와 관련된 옵션)
[root@localhost ~]# docker run -i -t centos /bin/bash
-> exit 명령어로 컨테이너 프로세스 종료
-> container 유지하며 host 콘솔로 나갈땐 Ctrl+p 그리고 Ctrl+q
5. Ctrl+p and Ctrl+q 로 host콘솔에서 프로세스 확인
6. 다시 컨테이너 환경에 연결
[root@localhost ~]# docker attach 1965ae3e4d31
-> host 측에서 컨테이너 환경 프로세스 종료
[root@localhost ~]# docker kill 1965ae3e4d31
참고: http://serverworld.kr/493