Install docker in CLI
Install Homebrew
1ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"Install docker toolbox
12brew cask install docker-toolboxbrew install caskroom/cask/brew-cask
How to Start docker
check the docker version
1docker versionlist the docker machine
1docker-machine lscreate the docker machine
1docker-machine create --driver "virtualbox" myBoxNamestart the docker machine
1docker-machine start myBoxNameget into the env of the docker machine
1eval $(docker-machine env myBoxName)123456export DOCKER_TLS_VERIFY="1"export DOCKER_HOST="tcp://192.168.99.100:2376"export DOCKER_CERT_PATH="/Users/huklee/.docker/machine/machines/myBoxName"export DOCKER_MACHINE_NAME="myBoxName"# Run this command to configure your shell:# eval $(docker-machine env myBoxName)when the certification is not working
1docker-machine regenerate-certs myBoxName
Start the docker image on the docker box
see the docker image list
1docker imagessearch the docker images on web
12docker search [image]# ex) docker search centosdownload the docker image
1docker pull centos:latestthe simple test of docker
123456docker run hello-worlddocker run -d -i -t --name "test2" ubuntu /bin/bash # -d : backgrounddocker run -it --name "test1" centos /bin/caldocker psattach the docker process
1docker attach hello- to exit without stop :
- to exit without stop :
docker daemon이 꺼져 있는 경우 / docker server is off
- Mac에서는 일단 docker Quickstart Terminal을 찾아서 키면 자동으로 docker daemon default 세팅이 된다.
이후에 아래 명령을 실행해 주면 된다.
start the docker machine
1docker-machine start myBoxNameget into the env of the docker machine
1eval $(docker-machine env myBoxName)
궁금한 점들
- docker를 사용해서 ubuntu / centos 등을 실행시키면 실제 파일 저장 경로라던가 하는 것들은 어떻게 되는 것인지?
- 왜 sudo 를 사용하면 docker-toolbox를 사용했을 때, 에러가 나는가.
- 왜 그렇게 ubuntu같은 것들도 용량이 무지하게 작은가?
- file system을 공유해서 실제 file directory처럼 사용하는 것이 가능한가?