Last active
August 27, 2016 17:15
-
-
Save roylee0704/010c978b8aa6cf3d04947d5bab1bb517 to your computer and use it in GitHub Desktop.
Starts docker-host(aka virtual-box).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A START DOCKER HOST. | |
# 1. List all docker-hosts. By default, you shall see `default`, named docker-host. | |
docker-machine ls | |
#NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS | |
#default - virtualbox Stopped Unknown | |
# 2. Start your docker-host | |
docker-machine start default | |
#Starting "default"... | |
#(default) Check network to re-create if needed... | |
#(default) Waiting for an IP... | |
#Machine "default" was started. | |
#Waiting for SSH to be available... | |
#Detecting the provisioner... | |
#Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command. | |
# 3. Run this command to configure your shell: | |
eval "$(docker-machine env default)" | |
# 4. Running that command resulted in exporting values to env path. | |
#export DOCKER_TLS_VERIFY="1" | |
#export DOCKER_HOST="tcp://192.168.99.100:2376" | |
#export DOCKER_CERT_PATH="/Users/roylee/.docker/machine/machines/default" | |
#export DOCKER_MACHINE_NAME="default" | |
# B. VERIFY DOCKER HOST has started. | |
# 1. To verify if docker-host is up, fire a request via docker-client. | |
docker version | |
docker ps | |
docker ps -a | |
# 2. Get the IP address of one or more machines(virtual-box). | |
# Especially useful when you want to `speak:{http|tcp}` with the daemon-app in container. | |
docker-machine ip default #docker-machine ip <virtual-box-name> | |
# C. DOCKER IMAGE! | |
# 1. Wrote a Dockerfile? Let's build it! it will become an image. | |
docker build -t roylee0704/playdocker . | |
# D. DOCKER CONTAINER! | |
# Its time to run it. Note: you may spawn as many container as you wish from the same image. | |
# 1. tty to your container. | |
docker run --rm -ti roylee0704/playdocker /bin/bash | |
# 2. sometimes, you may pass environment variables to CMD["your_app"]. | |
docker run --rm roylee0704/playdocker -e port=1123 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment