By Team Clofus Innovations | Mon Jan 17 2022
A good way to segregate dev environments is to spin up a virtual machine (VM) for each project, and install your stack there. When you need to work on the project, simply spin up the VM – no need to upgrade code, your environment will remain the same as how you left it. There are two options available for installing docker on windows.
To get started, head over to the Docker documentation pages for instructions on how to install Docker on your OS. The instructions differ depending on your OS:
If you are running OS X or Windows, you can’t install Docker directly, since it requires a Linux host to create containers. Luckily the Boot2Docker project was built to specifically fill this void.
Using the Dockerfiles is as simple as having the docker daemon run one. The output after executing the script will be the ID of the new docker image.
#Build an image using the Dockerfile at current
location
#Example: sudo docker build -t [name] .
sudo docker build -t my_mongodb.
Using the nano text editor, let’s start editing our Dockerfile.
sudo nano Dockerfile
#Set the base image to Ubuntu
FROM ubuntu
#File Author / Maintainer
MAINTAINER Example McAuthor
docker build -t myprojectimage.
docker run -it -v C:\Users\Clofus1\Documents\myprojects:/srv/myprojectsfolder -dp 80:80 -p 27017:27017 --name myprojectcontainer myprojectimage
docker exec -it <cid> bash
docker stop <cid>
docker rm <cid>
docker rmi <image id>
docker ps
docker ps -a