Docker + ubuntu
설치
$ sudo apt install docker-ce
Image 목록
$ docker images
Image 가져오기
$ docker pull ubuntu
Image 지우기
$ docker rmi ubuntu
Container 목록
$ docker ps -a
실행
$ docker run -ti ubuntu:12.04 /bin/bash
Daemon 으로 실행
$ docker run -d -ti ubuntu:12.04 /bin/sshd -D
Container 재실행
$ docker restart $CONTAINER_ID
Host path 공유
$ docker run -ti ubuntu:12.04 -v /opt:/opt /bin/bash
dns 설정
$ docker run --dns 8.8.8.8 -ti ubuntu:12.04 /bin/bash
Container 를 image 로 저장
$ docker commit $CONTAINER_ID $IMAGE_NAME
언어 설정
참고:
https://www.44bits.io/ko/post/setup_linux_locale_on_ubuntu_and_debian_container
$ export LC_ALL=C.UTF-8
GUI 사용
docker run 옵션에 추가
- -e DISPLAY=$DISPLAY
- -v /tmp/.X11-unix:/tmp/.X11-unix
- -e QT_X11_NO_MITSHM=1
host machine 에서 xhost 연결 허용
$ xhost +
Docker compose
https://docs.docker.com/compose/
설치 예) 리눅스
https://docs.docker.com/compose/install/
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
$ docker-compose --version
사용 예)
$ docker-compose up -d
$ docker-compose down