Help us understand the problem. What is going on with this article?

boot2dockerでvagrant share使ってみた

More than 5 years have passed since last update.

参考:

スクリーンショット 2014-09-03 9.44.49.png

準備

  • Vagrant, Virtualboxをインストールしておく。
  • Virtualbox guest additionsが含まれているVagrant Cloudイメージを使う。
git clone https://github.com/dduportal/boot2docker-vagrant-box.git
cd boot2docker-vagrant-box

gitをインストールしていない場合はzipをダウンロード

Vagrantfile
+ config.vm.synced_folder ENV['HOME'], "/vagrant_data"
+ config.vm.network :forwarded_port, guest: 80, host: 8080
boot2dockerに接続し適当なhttpdを用意
vagrant up
vagrant ssh
docker run \
  --name=wordpress4 \
  -it -d \
  -p 80:80 \
  -v /vagrant_data:/root \
  tukiyo3/ubuntu-debootstrap-ja:14.04-wordpress4 \
  /bin/bash
  • /vagrant_data/ を /root/にマウントする場合の例。

vagrant share用設定

vagrant login
$ vagrant login
In a moment we'll ask for your username and password to Vagrant Cloud.
After authenticating, we will store an access token locally. Your
login details will be transmitted over a secure connection, and are
never stored on disk locally.

If you don't have a Vagrant Cloud account, sign up at vagrantcloud.com

Username or Email: tukiyo3
Password (will be hidden):
You're now logged in!
vagrant share
$ vagrant share --http=8080
==> default: Detecting network information for machine...
    default: Local machine address: 127.0.0.1
    default:
    default: Note: With the local address (127.0.0.1), Vagrant Share can only
    default: share any ports you have forwarded. Assign an IP or address to your
    default: machine to expose all TCP ports. Consult the documentation
    default: for your provider ('virtualbox') for more information.
    default:
    default: Local HTTP port: 8080
    default: Local HTTPS port: disabled
    default: Port: 2201
    default: Port: 2200
    default: Port: 8080
==> default: Checking authentication and authorization...
==> default: Creating Vagrant Share session...
    default: Share will be at: fantastic-crow-4926
==> default: Your Vagrant Share is running! Name: fantastic-crow-4926
==> default: URL: http://fantastic-crow-4926.vagrantshare.com
==> default:
==> default: You're sharing your Vagrant machine in "restricted" mode. This
==> default: means that only the ports listed above will be accessible by
==> default: other users (either via the web URL or using `vagrant connect`).

(このURLはvagrant shareを実行するたびに変更される。)

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away