alexanderzeitler.com - Workflows: using Docker Machine and Docker Compose together in development









Search Preview

Workflows: using Docker Machine and Docker Compose together in development | Alexander Zeitler

alexanderzeitler.com

.com > alexanderzeitler.com

SEO audit: Content analysis

Language Error! No language localisation is found.
Title Workflows: using Docker Machine and Docker Compose together in development | Alexander Zeitler
Text / HTML ratio 59 %
Frame Excellent! The website does not use iFrame solutions.
Flash Excellent! The website does not have any flash contents.
Keywords cloud Docker Machine docker container run Compose default = var app command application MongoDb mynodeapp rsync folder dockermachine inside result local
Keywords consistency
Keyword Content Title Description Headings
Docker 58
Machine 30
docker 24
container 22
run 20
Compose 16
Headings
H1 H2 H3 H4 H5 H6
8 0 0 0 0 0
Images We found 1 images on this web page.

SEO Keywords (Single)

Keyword Occurrence Density
Docker 58 2.90 %
Machine 30 1.50 %
docker 24 1.20 %
container 22 1.10 %
run 20 1.00 %
Compose 16 0.80 %
default 16 0.80 %
= 14 0.70 %
var 14 0.70 %
app 13 0.65 %
command 12 0.60 %
application 12 0.60 %
MongoDb 12 0.60 %
mynodeapp 12 0.60 %
rsync 11 0.55 %
folder 11 0.55 %
dockermachine 11 0.55 %
inside 11 0.55 %
result 10 0.50 %
local 10 0.50 %

SEO Keywords (Two Word)

Keyword Occurrence Density
Docker Machine 28 1.40 %
Machine and 12 0.60 %
the Docker 11 0.55 %
docker run 11 0.55 %
the container 10 0.50 %
to the 10 0.50 %
like this 10 0.50 %
Docker Compose 9 0.45 %
run d 8 0.40 %
p 30003000 8 0.40 %
it name=mynodeappcontainer 8 0.40 %
we can 8 0.40 %
in the 8 0.40 %
d it 8 0.40 %
of the 7 0.35 %
inside the 7 0.35 %
in our 7 0.35 %
v pwdapp 6 0.30 %
30003000 mynodeapp 6 0.30 %
pwdapp p 5 0.25 %

SEO Keywords (Three Word)

Keyword Occurrence Density Possible Spam
Docker Machine and 11 0.55 % No
run d it 8 0.40 % No
docker run d 8 0.40 % No
p 30003000 mynodeapp 6 0.30 % No
d it name=mynodeappcontainer 6 0.30 % No
the Docker Machine 5 0.25 % No
v pwdapp p 5 0.25 % No
dockermachine ssh default 5 0.25 % No
name=mynodeappcontainer v pwdapp 5 0.25 % No
it name=mynodeappcontainer v 5 0.25 % No
pwdapp p 30003000 5 0.25 % No
build t mynodeapp 4 0.20 % No
docker build t 4 0.20 % No
and Docker Compose 4 0.20 % No
Machine and Docker 4 0.20 % No
it name=mynodeappcontainer p 3 0.15 % No
our browser to 3 0.15 % No
the Docker engine 3 0.15 % No
name=mynodeappcontainer p 30003000 3 0.15 % No
folder inside the 3 0.15 % No

SEO Keywords (Four Word)

Keyword Occurrence Density Possible Spam
docker run d it 8 0.40 % No
run d it name=mynodeappcontainer 6 0.30 % No
name=mynodeappcontainer v pwdapp p 5 0.25 % No
v pwdapp p 30003000 5 0.25 % No
d it name=mynodeappcontainer v 5 0.25 % No
it name=mynodeappcontainer v pwdapp 5 0.25 % No
docker build t mynodeapp 4 0.20 % No
Machine and Docker Compose 4 0.20 % No
Docker Machine and Docker 4 0.20 % No
name=mynodeappcontainer p 30003000 mynodeapp 3 0.15 % No
pwdapp p 30003000 mynodeapp 3 0.15 % No
dockermachine ssh default mkdir 3 0.15 % No
default mkdir p pwd 3 0.15 % No
it name=mynodeappcontainer p 30003000 3 0.15 % No
ssh default mkdir p 3 0.15 % No
var express = require'express' 3 0.15 % No
express = require'express' var 3 0.15 % No
= require'express' var app 3 0.15 % No
require'express' var app = 3 0.15 % No
var app = express 3 0.15 % No

Internal links in - alexanderzeitler.com

Fixing Chrome 58+ [missing_subjectAltName] with openssl when using self signed certificates
Fixing Chrome 58+ [missing_subjectAltName] with openssl when using self signed certificates | Alexander Zeitler
Accessing an HTTP API running on your MacBook in a Docker container from your iPhone/iPad using dnsmasq
Accessing an HTTP API running on your MacBook in a Docker container from your iPhone/iPad using dnsmasq | Alexander Zeitler
Deploying Ubuntu Mate Desktop as a developer environment in a Azure VM
Deploying Ubuntu Mate Desktop as a developer environment in a Azure VM | Alexander Zeitler
Deploying Ubuntu Mate Desktop as a developer environment in AWS EC2
Deploying Ubuntu Mate Desktop as a developer environment in AWS EC2 | Alexander Zeitler
Debugging mocha tests in a Docker container using Visual Studio Code
Debugging mocha tests in a Docker container using Visual Studio Code | Alexander Zeitler
Debugging mocha tests with Visual Studio Code when Node.js is installed using nvm
Debugging mocha tests with Visual Studio Code when Node.js is installed using nvm | Alexander Zeitler
Debugging a ES6 Node.js application in a Docker container using Visual Studio Code
Debugging a ES6 Node.js application in a Docker container using Visual Studio Code | Alexander Zeitler
Some thoughts on Open Source Software
Some thoughts on Open Source Software | Alexander Zeitler
Resizing a VMware Workstation VM partition using GParted - get the swap partition out of my way!
Resizing a VMware Workstation VM partition using GParted - get the swap partition out of my way! | Alexander Zeitler
Workflows: using Docker Machine and Docker Compose together in development
Workflows: using Docker Machine and Docker Compose together in development | Alexander Zeitler
Chrome crashes on Ubuntu in VMware Workstation
Chrome crashes on Ubuntu in VMware Workstation | Alexander Zeitler
Rename Visual Studio project including files, folders and namespaces
Rename Visual Studio project including files, folders and namespaces | Alexander Zeitler
A lap around AWS and docker-machine
A lap around AWS and docker-machine | Alexander Zeitler
Integration-testing ASP.NET 5 / MVC 6 Controllers on DNX Beta 4
Integration-testing ASP.NET 5 / MVC 6 Controllers on DNX Beta 4 | Alexander Zeitler
Deploying a ASP.NET MVC 6 API as Azure API App in Azure App Services
Deploying a ASP.NET MVC 6 API as Azure API App in Azure App Services | Alexander Zeitler
lowerCamelCase JSON with ASP.NET MVC 6
lowerCamelCase JSON with ASP.NET MVC 6 | Alexander Zeitler
Running ASP.NET 5 Beta 4 in Docker with DNX runtime #aspnet5 #docker
Running ASP.NET 5 Beta 4 in Docker with DNX runtime #aspnet5 #docker | Alexander Zeitler
Stop complaining or improve yourself
Stop complaining or improve yourself | Alexander Zeitler
#NodeJS / #ExpressJS: Adding routes dynamically at runtime
#NodeJS / #ExpressJS: Adding routes dynamically at runtime | Alexander Zeitler
mongoose: Referencing schema in properties or arrays
mongoose: Referencing schema in properties or arrays | Alexander Zeitler
MongoDB development environment journal size management using mongoctl
MongoDB development environment journal size management using mongoctl | Alexander Zeitler
Farewell...
Farewell... | Alexander Zeitler
Inspecting AngularJS $scope using Firebug and Chrome Developer Tools
Inspecting AngularJS $scope using Firebug and Chrome Developer Tools | Alexander Zeitler
Useful @Brackets extensions for Web Developers
Useful @Brackets extensions for Web Developers | Alexander Zeitler
.NET User Group Karlsruhe: StreamInsight: Complex Event Processing by Microsoft
.NET User Group Karlsruhe: StreamInsight: Complex Event Processing by Microsoft | Alexander Zeitler
“Commit all must be called when a managed buffer has focus” in Microsoft SQL Server Data Tools
“Commit all must be called when a managed buffer has focus” in Microsoft SQL Server Data Tools | Alexander Zeitler
.NET User Group Karlsruhe: Git
.NET User Group Karlsruhe: Git | Alexander Zeitler
Open Source Windows 8 App: Sprudelsuche
Open Source Windows 8 App: Sprudelsuche | Alexander Zeitler
Open Source– Scheissegal?
Open Source– Scheissegal? | Alexander Zeitler
Lowercase JSON with ASP.NET Web API
Lowercase JSON with ASP.NET Web API | Alexander Zeitler
.NET Usergroup Karlsruhe: Think Big – Entwicklung skalierbarer Anwendungen mit Windows Azure
.NET Usergroup Karlsruhe: Think Big – Entwicklung skalierbarer Anwendungen mit Windows Azure | Alexander Zeitler
ASP.NET Web API and RavenDb
ASP.NET Web API and RavenDb | Alexander Zeitler
ASP.NET Web API Round-Up Slides
ASP.NET Web API Round-Up Slides | Alexander Zeitler
ASP.NET MVC 4 public beta including ASP.NET Web API
ASP.NET MVC 4 public beta including ASP.NET Web API | Alexander Zeitler
Hash Bang Urls in Single Page Applications mit ASP.NET MVC
Hash Bang Urls in Single Page Applications mit ASP.NET MVC | Alexander Zeitler
.NET User Group Karlsruhe: Know your Tools
.NET User Group Karlsruhe: Know your Tools | Alexander Zeitler
Git flow init liefert: flags: FATAL unable to determine getopt version unter Cygwin
Git flow init liefert: flags: FATAL unable to determine getopt version unter Cygwin | Alexander Zeitler
Using JsonValue and JsonArray in WCF Web API
Using JsonValue and JsonArray in WCF Web API | Alexander Zeitler
.NET User Group Karlsruhe: PowerShell 3.. 2.. 1..
.NET User Group Karlsruhe: PowerShell 3.. 2.. 1.. | Alexander Zeitler
What’s new in WCF Web API Preview 5 – introducing the test client
What’s new in WCF Web API Preview 5 – introducing the test client | Alexander Zeitler
Externe Templates in KnockoutJS laden
Externe Templates in KnockoutJS laden | Alexander Zeitler
WCF Web API: Role based access control with basic authentication
WCF Web API: Role based access control with basic authentication | Alexander Zeitler
.NET User Group Karlsruhe: Produce Cleaner Code with Aspect-Oriented Programming (AOP)
.NET User Group Karlsruhe: Produce Cleaner Code with Aspect-Oriented Programming (AOP) | Alexander Zeitler
REST using the WCF Web API – POST it!
REST using the WCF Web API – POST it! | Alexander Zeitler
REST using the WCF Web API – getting more RESTful responses (Part 5)
REST using the WCF Web API – getting more RESTful responses (Part 5) | Alexander Zeitler
TypeLoadException when mocking COM objects - Could not load type … from assembly. The type is marked…
TypeLoadException when mocking COM objects - Could not load type … from assembly. The type is marked… | Alexander Zeitler
REST using the WCF Web API – getting RESTful the BDD way (Part 4)
REST using the WCF Web API – getting RESTful the BDD way (Part 4) | Alexander Zeitler
REST using the WCF Web API – refactoring to IoC style (Part 3)
REST using the WCF Web API – refactoring to IoC style (Part 3) | Alexander Zeitler
REST using the WCF Web API – Basics (Part2)
REST using the WCF Web API – Basics (Part2) | Alexander Zeitler
Microsoft Web API – the REST is done by WCF (Part 1)
Microsoft Web API – the REST is done by WCF (Part 1) | Alexander Zeitler
Microsoft Web API – den REST macht WCF (Teil 1)
Microsoft Web API – den REST macht WCF (Teil 1) | Alexander Zeitler
.NET User Group Karlsruhe: Flexible Softwarearchitekturen mit Inversion of Control (IoC)
.NET User Group Karlsruhe: Flexible Softwarearchitekturen mit Inversion of Control (IoC) | Alexander Zeitler
machine.fakes ReSharper Templates
machine.fakes ReSharper Templates | Alexander Zeitler
CreateCert.cmd aus dem Windows Azure Platform Training Kit funktioniert nicht
CreateCert.cmd aus dem Windows Azure Platform Training Kit funktioniert nicht | Alexander Zeitler
JSON via jQuery direkt an einen ASP.NET MVC 3 Controller senden
JSON via jQuery direkt an einen ASP.NET MVC 3 Controller senden | Alexander Zeitler
POSTing Json data using the HttpClient from WCF Web API
POSTing Json data using the HttpClient from WCF Web API | Alexander Zeitler
Using the new WCF Web APIs HttpClient with ASP.NET Forms Authentication
Using the new WCF Web APIs HttpClient with ASP.NET Forms Authentication | Alexander Zeitler
Keyboard Jedi unter x64
Keyboard Jedi unter x64 | Alexander Zeitler
Using WCF Web APIs / WCF Http with ASP.NET Forms Authentication
Using WCF Web APIs / WCF Http with ASP.NET Forms Authentication | Alexander Zeitler
WCF Web APIs / WCF Http mit ASP.NET Forms Authentication verwenden
WCF Web APIs / WCF Http mit ASP.NET Forms Authentication verwenden | Alexander Zeitler
ILSpy – Open Source .NET Assembly Browser und Decompiler
ILSpy – Open Source .NET Assembly Browser und Decompiler | Alexander Zeitler

Alexanderzeitler.com Spined HTML


Workflows: using Docker Machine and Docker Compose together in minutiae | Alexander Zeitler Toggle navigation Home Feed Workflows: using Docker Machine and Docker Compose together in minutiae Written on February 01, 2016 We're using the Docker eco system now for a while in minutiae and production. As you may know, the Docker eco system not only consists of the Docker engine (client and server), but it moreover provides Docker Machine and Docker Compose. While Docker Compose makes linking containers much easier, Docker Machine provides an wresting for your environment where your Docker engine is stuff executed in. Thus, Machine allows you to manage your Docker engine Host in a resulting way no matter whether you're on AWS, Azure or on premise - or plane your local dev environment. Docker Machine and Docker Compose work together pretty well in production, but when using them in development, you might wits some issues - some of which I'll describe in this post and show solutions for it. This post is not well-nigh using Docker, Docker Machine or Compose in production! Plain Docker minutiae workflow with Node.js / Express First, some basics. Let's consider we're composing an Docker using using a MongoDb database and we're implementing a Node.js using that uses MongoDb. A vital Docker workflow without Machine and Compose would squint like this: Create a Dockerfile for our Node.js application: FROM node:4.2.3 EXPOSE 3000 EXPOSE 5858 COPY . /app WORKDIR /app RUN cd /app; npm install CMD ["node", "app.js"] Create our simplified Node.js appliation in app.js: var express = require('express'); var app = express(); app.use(express.static('public')); app.listen(3000); Place an index.html inside the public folder: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Hello</title> </head> <body> Hello </body> </html> Now we can build our image like this: docker build -t my-node-app . Then we can run our container based on this image: docker run -it --name=my-node-app-container -p 3000:3000 my-node-app Pointing our browser to http://localhost:3000/ will return this result: If we're waffly something in our index.html, we have to stop and remove our container, rebuild the image and start the container again: docker stop my-node-app-container docker rm my-node-app-container docker build -t my-node-app . docker run -it --name=my-node-app-container -p 3000:3000 my-node-appMoreoverthis happens quite fast, we can get it plane faster by mounting our local project folder as a volume for our container: docker build -t my-node-app . docker run -d -it --name=my-node-app-container -v $(pwd):/app -p 3000:3000 my-node-app By subtracting the -v $(pwd):/app parameter to our docker run command, we're mapping the local project folder into the /app folder in our container. Now we can modify the content in unelevated our public folder and just hit F5 in our browser to get the latest changes. Let's get a bit remoter and add an API to our using and transpiration the app.js as follows: var express = require('express'); var app = express(); app.use(express.static('public')); app.get('/hello', function (req, res) { res.send('world'); }); app.listen(3000);Withoutthis, we can run HTTPIe (or flourish / wget) http get localhost:3000/hello and receive an output like this: HTTP/1.1 200 OK Connection: keep-alive Content-Length: 5 Content-Type: text/html; charset=utf-8 Date: Sat, 23 Jan 2016 20:55:07 GMT ETag: W/"5-fXkwN6B2AYZXSwKC8vQ15w" X-Powered-By: Express worldWafflysomething in the API and running HTTPIe won't result in updated output. This is considering express needs to be initialized then to run the app with the changes made. We have two options to re-initialize the container: restart the container or skiver it and run it again. Restarting the container is a single command: docker restart my-node-app-container.Moreoverthis writ is pretty simple, it may take a few seconds to gracefully stop and start the container. The second option is a bit faster and looks like this: docker skiver my-node-app-container docker run -d -it --name=my-node-app-container -v $(pwd):/app -p 3000:3000 my-node-app Plain Docker workflow with Node.js and MongoDb As said older in this post, our goal is to have an using that runs on Node.js and uses MongoDb.SubtractingMongoDb to our game is as simple as this: docker run -d -it --name=some-mongo -p 27017:27017 mongo In order to connect our Node.js App container with the MongoDb container, we have to run it using: docker run -d -it --name=my-node-app-container -v $(pwd):/app -p 3000:3000 --link some-mongo:mongo my-node-app Now let's transpiration our Node.js using to use MongoDb and write the request soul of a POST to /hello to the documents colleciton in MongoDb: var express = require('express'); var app = express(); var bodyparser = require('body-parser'); var MongoClient = require('mongodb').MongoClient; var url = 'mongodb://' + process.env.MONGO_PORT_27017_TCP_ADDR + ':27017/dockerdemo'; var db; MongoClient.connect(url, function (err, database) { console.log("Connected correctly to server"); db = database; }); app.use(bodyparser.json()); app.use(express.static('public')); var insertDocument = function (db, document, callback) { // Get the documents hodgepodge var hodgepodge = db.collection('documents'); // Insert some documents collection.insertOne(document, function (err, result) { callback(err, JSON.stringify(result.ops[0])); }); }; app.post('/hello', function (req, res) { var data = req.body; insertDocument(db, data, function(err, result) { res.status(201).send(result) }) }); app.get('/hello', function (req, res) { res.send('world'); }); app.listen(3000); Sending a request using to our API like this http post http://localhost:3000/hello name=PDMLab will result in a successful response: HTTP/1.1 201 Created Connection: keep-alive Content-Length: 50 Content-Type: application/json; charset=utf-8 Date: Wed, 27 Jan 2016 21:54:21 GMT ETag: W/"32-YLqScoop9RrYa0x7JH+FIg" X-Powered-By: Express { "_id": "56a93c8d51a0630100b28294", "name": "PDMLab" } Using nodemon we can skiver and start the containers as shown surpassing and we have a nice minutiae workflow. Simplifying container linking using Docker Compose Now lets go one step remoter and add Docker Compose to handle the container linking. Using Compose, you don't link containers using the Docker CLI, but instead you create a file named docker-compose.yml (you can name it as you like but the Compose CLI uses this by default). The Compose file for our using looks like this: mongo: image: mongo:2.6.11 ports: - "27017:27017" application: build: . command: node --debug=5858 app.js --color=always ports: - "3000:3000" - "5858:5858" volumes : - ./:/app links: - mongo When issuing the http POST as shown above, we'll get a similar result. Refreshing our index.html without restarting the containers still works. This happens considering we're mapping the current folder to the /app folder using inside the volumes section of the appliation container definition. Restarting the container can be streamlined using nodemon like this: nodemon -x docker-compose up This will ensure that changes to the API part of our using are unromantic as shown before.SubtractingDocker Machine to the scene Now it's time to introduce Docker Machine and show how it plays together with our existing setup. We can simply create a new Docker Machine instance named default: docker-machine create --driver=virtualbox default To make sure our Docker vendee talks to the Docker engine in our default machine, we'll update the environment: eval $(docker-machine env default) First, lets try to build and run our first sample from whilom with Docker Machine: docker run -d -it --name=my-node-app-container -p 3000:3000 my-node-app Pointing the browser then to http://localhost:3000 will goof to wangle the site. This happens considering port 3000 is not unshut in VirtualBox where the VM (our machine named default) is running. To solve this, we can unshut the port using the VirtualBox port forwading Network setting for the machine or simply run VBoxManage on the console: VBoxManage modifyvm "default" --natpf1 "default,tcp,,3000,,3000" Trying to unshut the website then then will result in the expected Hello World response.Flipsideoption (my preference) to wangle our using running in the machine, is to use the IP write of the machine. To retrieve it, we undeniability docker-machine ip default This will result, for example, in 192.168.99.100 and pointing our browser to http://192.168.99.100:3000/ will return the expected response as well. Docker Machine and Volumes The next thing we tried was the usage of Volumes and we'll now try this with Docker Machine as well. Our writ was this, so lets use it again: docker run -d -it --name=my-node-app-container -v $(pwd):/app -p 3000:3000 my-node-app The panel result will squint fine at a first sight: 098b5a3387df42092bec984105bf9f6725e11088d3f62d72a893f586cb33bc50 But when we try to unshut the using in our browser, it fails again. Looking at our list of running containers using docker ps doesn't show our my-node-app-container running. What happened? Let's dig a bit deeper using docker logs my-node-app-container. The result will squint like this: module.js:339 throw err; ^ Error: Cannot find module '/app/app.js' at Function.Module._resolveFilename (module.js:337:15) at Function.Module._load (module.js:287:25) at Function.Module.runMain (module.js:467:10) at startup (node.js:136:18) at node.js:963:3 The reason for this is that we're telling the Docker engine to map our local directory to the /app folder inside the container. The problem here: our local folder doesn't exist in the Docker Machine default thats running inside VirtualBox. Docker Machine provides a solution for this. We can use the ssh writ provided by Docker Machine to create the "local" folder inside the machine and then use the Docker Machine scp writ to reprinting the files from our host into that folder inside the machine: docker-machine ssh default mkdir -p $(pwd) docker-machine scp -r . default:$(pwd) Copying the files has to be washed-up every time our source lawmaking changes.Consideringthe scp writ is a all or nothing operation, I was looking for flipside solution that copies only the file changed. One option would be Grunt or Gulp to get the particular file transpiration but I'm not a friend of these tools. A wide spread tool is rsync which exactly does what we want: reprinting all reverted files. The good part of the story: in the end it works. The bad part: There's "a little" work to do. First, to make sure all remoter rsync commands work as expected, we need to get the SSH key to be used by rsync. This is washed-up by the pursuit commands: eval $(ssh-agent) ssh-add ~/.docker/machine/machines/default/id_rsa Next, we need to know that the OS running inside Docker Machine does NOT provide an rsync installation out of the box. To the resuce, boot2docker (based on Tiny Core Linux), the OS running inside Docker Machine, comes with an package manager named tce and using the pursuit command, we can installed rsync inside our Docker Machine: docker-machine ssh default -- tce-load -wi rsync Next, we have to create the directory with the same path as our local path in our Docker Machine and then sync our local directory to the Docker Machine: docker-machine ssh default mkdir -p $(pwd) rsync -avzhe ssh --relative --omit-dir-times --progress ./ docker@$(docker-machine ip default):$(pwd)Withoutthis, we'll skiver our my-node-app-container and restart it: docker skiver my-node-app-container docker start my-node-app-container In the end, you'll put the rsync writ and restarting of the container into a .sh file and undeniability this from nodemon. Running this container together with the MongoDb container works similar to the sample shown in the section without MongoDb but of undertow with the rsync stuff applied. Docker Machine and Docker Compose together The last part of this post will show how to run your containers in Docker Machine and get the sonnet washed-up by Docker Compose. Our docker-compose.yml file looks exactly the same as before: mongo: image: mongo:2.6.11 ports: - "27017:27017" application: build: . command: node --debug=5858 app.js --color=always ports: - "3000:3000" - "5858:5858" volumes: - ./:/app links: - mongo In order to get Docker Machine and Compose work together and have a smooth minutiae workflow, you'll have to add the docker-compose up writ to your same .sh script and restart this by nodemon like this: nodemon -x syncandrestartcontainers.sh Finally, syncandrestartcontainers.sh will squint like this: eval $(ssh-agent) ssh-add ~/.docker/machine/machines/default/id_rsa rsync -avzhe ssh --relative --omit-dir-times --progress ./ docker@$(docker-machine ip default):$(pwd) docker-compose up Some tips for the praxis when using this workflow:Surpassingstarting this workflow stop your Docker Machine and restart it using docker-machine restart default (don't forget eval $(docker-machine env default) without it) delete the "local" directory inside the Docker Machine using docker-machine ssh default sudo -i "sudo rm -rf $(pwd)" create the "local" directory inside the Docker Machine using docker-machine ssh default mkdir -p $(pwd) Update 2016, 3rd February One increasingly thing... Docker networking As suggested in the comments, this update of the post shows you how to use Docker networking which has been introduced in Docker 1.9. You can read the nuts well-nigh Docker network here - please read them first and then protract here... Welcome when ;-) First, lets create a custom bridged network named my-app-network: docker network create --driver=bridge my-app-network Next, we'll start our MongoDb container unfluctuating to the network: docker run -d -it --name=some-mongo --net=my-app-network -p 27017:27017 mongo:2.6.11 As Docker networking doesn't use environment variables to share connection settings but the container names instead, we need to transpiration the MongoDb connection string in our app.js accordingly: var url = 'mongodb://some-mongo:27017/dockerdemo'; Then, rebuild our image: docker build -t my-node-app . And finally, run our app container unfluctuating to the network as well: docker run -d -it --name=my-node-app-container -v $(pwd):/app -p 3000:3000 --net=my-app-network my-node-app Issuing a http post http://localhost:3000/hello name=PDMLab then works fine as before. Docker networking moreover works fine with Docker Machine, just make sure you follow the steps (rsync etc.) shown above. Docker networking in Docker Compose is experimental at the moment so I won't show that now. End of Update 2016, 3rd February Happy developing using Docker Machine and Compose ;-) P.S.: If you came up with other solutions, please let me know in the comments. Please enable JavaScript to view the comments powered by Disqus. Copyright © Alexander Zeitler 2003 - 2016 | Impressum