Wednesday, June 3, 2015

boot2docker in terminal MacOSX

Initialize boot2docker

> boot2docker init

Start boot2docker

> boot2docker start

Set the environment variables in the current terminal.

> eval "$(boot2docker shellinit)"

Test run

> docker run hello-world

To run an Nginx server (-d for running in background):

> docker run -d -P --name web nginx

Stop

> boot2docker stop

Check status

> boot2docker status

Built an image:

> docker build -t .

Access home folder:

> cd $HOME

Mount a local directory to the image's directory

echo "my new site" > index.html
> docker run -d -P -v $HOME/site:/usr/share/nginx/html --name mysite nginx

upgrade boot2docker

> boot2docker stop
> boot2docker upgrade

No comments:

Post a Comment