Docker ubuntu server enviroment on Windows 10 (max build times)

Hi all, if someone has slow build times on Windows, we can use docker and mount share drives on windows.
So i succeeded.

First, we need enable Hyper-V on windows features.
hyper-v.png

and install docker for windows.

Mongo

Setup Mongo Database:

docker pull mongo

Run mongodb:

docker run 
    --name mongo \
    --restart=always \
    -v C:\Users:/data \
    -p 127.0.0.1:27017:27017 
    -d mongo mongod \
    --smallfiles

or in 1 line:

docker run --name mongo --restart=always -v C:\Users:/data -p 127.0.0.1:27017:27017 -d mongo mongod --smallfiles

Connect to mongodb from host

Connect with this url:
mongodb://mongo:27017

or
mongodb://127.0.0.1:27017

Connect to MongoDB console

docker exec -it mongo mongo admin

you can see detail from mongo instance here: Mongo


Meteor

Setup ubuntu meteor:

docker pull lynam/meteor

Start Meteor instance

 docker run \
    --name meteor \
    --cap-add=ALL \
    --restart=always \
    -d -t -i -v c:\Users\:/data \
    --link mongo:mongo \
    -e MONGO_URL=mongodb://mongo:27017 \
    -p 127.0.0.1:3000:3000 \
    lynam/meteor

or in 1 line

docker run --name meteor --cap-add=ALL --restart=always -d -i -t -v c:\Users\:/data --link mongo:mongo -e MONGO_URL=mongodb://mongo:27017 -p 127.0.0.1:3000:3000 lynam/meteor

Ubuntu

Run this command. make sure meteor instance started.

docker attach meteor

-> Default password for root and admin user: 123
-> By default you should login with admin user to work with meteor for secured purpose.

Build Meteor App

Access to ubuntu:

 docker attach meteor

Go to your project folder:

cd /data/project-folder
meteor run build ../bin

NOTE

  • Change c:\Users with your absolute path.
  • Change your mongo port or ip adress whatever you want (optional).
  • Change your meteor port if you want: ex: 127.0.0.1:4000:4000 (optional).
  • In Windows, make sure you have enabled sharing options and docker share drives options.
    enabled-sharing.png
    docker.png

So anytime pc starup, docker will load. we just docker attach meteor to login ubuntu enviroment.

2 Likes