Docker – 02 Win/Mac

Download Docker Desktop

Basic stuff

docker container run -it(interactive) -p(--publish) 80(localMachine):80(nginx container) nginx

docker container run -d(--detach) -p 8080:80(container) --name mynginx nginx

docker container run -d -p 8081:80 --name myapache httpd(name of the image)

docker container run -d -p 3306:3306 --name mysqldb --env MYSQL_ROOT_PASSWORD=password mysql

docker container exec -it mynginx bash

Bind mount

docker container run -d -p 8080:80 -v(area on our local machine , map to area in container-webroot) $(pwd):/usr/share/nginx/html --name nginx=website nginx   (might not work on windows)

This will set the webroot as the current working dir ….

 

docker rm $(docker ps -aq) -f

Try out Doodle

First, open a Mac terminal or Windows PowerShell and download a fun example.This repository contains everything you need to create your first container. New to git and don’t have it installed? Click on the ‘Want More Info?’ link on the bottom right for setup instructions.

git clone https://github.com/docker/doodle.git



Next Step

Now let’s build and tag a Docker image.A Docker image is a private filesystem, just for your container. It provides all the files and code your container will need. Running the docker build command creates a Docker image using the Dockerfile. This built image is in your machine’s local Docker image registry.

Mac users

docker login ;docker push vasiliokas/cheers2019

 

 

docker login &&docker push vasiliokas/cheers2019

Windows users (use PowerShell):

docker login ;docker push vasiliokas/cheers2019

 

 

docker run -it –rm vasiliokas/cheers2019

Share your image on Docker HubOnce you’re ready to share your container with the world, push the image that describes it to Docker Hub.

Mac users:

docker login &&docker push vasiliokas/cheers2019

Windows users (use PowerShell):

docker login ;docker push vasiliokas/cheers2019

 

 

cd doodle\cheers2019 ;docker build -t vasiliokas/cheers2019 .



Next Step

Great! Now let’s run your first container.Running a container launches your software with private resources, securely isolated from the rest of your machine.

docker run -it –rm vasiliokas/cheers2019

Share your image on Docker HubOnce you’re ready to share your container with the world, push the image that describes it to Docker Hub.

Mac users:

docker login &&docker push vasiliokas/cheers2019

Windows users (use PowerShell):

docker login ;docker push vasiliokas/cheers2019

 

 

cd doodle/cheers2019 &&docker build -t vasiliokas/cheers2019 .

Windows users (use PowerShell):

cd doodle\cheers2019 ;docker build -t vasiliokas/cheers2019 .



Next Step

Great! Now let’s run your first container.Running a container launches your software with private resources, securely isolated from the rest of your machine.

docker run -it –rm vasiliokas/cheers2019

Share your image on Docker HubOnce you’re ready to share your container with the world, push the image that describes it to Docker Hub.

Mac users:

docker login &&docker push vasiliokas/cheers2019

Windows users (use PowerShell):

docker login ;docker push vasiliokas/cheers2019

 

 

Was this article helpful?

Related Articles

Leave A Comment?