Last active
November 28, 2015 18:30
-
-
Save musha68k/d2575febfba337a0a1a2 to your computer and use it in GitHub Desktop.
Vagrant with Docker Engine
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
We need a Docker container engine which will enable us to run docker containers on OSX. | |
So the first step to get there is to create a Vagrant virtual machine image with the provider of your choice. | |
Vagrantfile: | |
``` | |
Vagrant.configure(2) do |config| | |
config.vm.box = 'ubuntu/trusty64' | |
config.ssh.insert_key = false | |
config.vm.define 'container-engine' do |node| | |
node.vm.hostname = 'container-engine' | |
end | |
end | |
``` | |
Ok let's spin up our container engine: | |
`vagrant up` | |
Check if you can connect to your running Vagrant box: | |
`vagrant ssh -c "exit"` | |
If we see get this, we know ssh is running successfully on our container engine: | |
`Connection to 172.16.36.173 closed.` | |
``` | |
docker-machine create -d generic \ | |
--generic-ssh-user vagrant \ | |
--generic-ssh-key ~/.vagrant.d/insecure_private_key \ | |
--generic-ip-address 172.16.36.173 \ | |
identity-provider-docker | |
``` | |
``` | |
FROM ruby:2.2.3 | |
COPY . /srv/ | |
WORKDIR /srv/ | |
RUN curl -sL https://deb.nodesource.com/setup_4.x | bash - | |
RUN apt-get install -y nodejs | |
RUN npm install -g rimraf | |
RUN npm install -g webpack | |
RUN npm install -g bower | |
RUN npm install | |
RUN npm run build | |
RUN bundle install | |
EXPOSE 9292 | |
CMD ["bundle", "exec", "rackup"] | |
``` | |
.dockerignore (put .vagrant in there) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment