Setting up a Docker container to move between hosts

By peterm, 28 August, 2015

Upon running this command on my MacBook Air:

docker run -i -t --name mymeanjs --link mymongodb:db_1 -p 80:3000 maccam912/meanjs:latest bash

We have a running container that needs to have the npm and bower installs completed before we can do much with it. We'll then clone meanjs from github and build it. This image It will also need Ruby and the gem sass installed.

So we navigate into the Development directory and clone the github repo, then start building things up.

cd Development/

git clone https://github.com/meanjs/mean.git meanjs

apt-get update

apt-get install ruby

cd meanjs/

npm install

bower install --allow-root

gem install sass

grunt build

grunt

In another shell, I started committing changes made to the docker container at each step in the build.

docker-machine env default

eval "$(docker-machine env default)"

docker ps -a

docker commit -a 'Peter McMillan <peterm@ucsc.edu>' -m 'maccam912/meanjs:latest with Ruby, sass meanjs built out via npm install and bower install' ee7bfd71df8b

docker commit -a 'Peter McMillan <peterm@ucsc.edu>' -m 'maccam912/meanjs:latest confirmed running stack' ee7bfd71df8b

docker ps -a

docker save maccam912/meanjs:latest > ~/Documents/docker-meanjs-complete.tar

Our result is a 1.09Gb tarball that should be able to move to a different server running docker and run without problems. 

Next step. Try moving it and running it on AWS hosts.

Tags