0.0 *** Install docker for windows community edition (CE) *** some basic setup required: -- create an account, settings etc. -- setting -> shared drives: check as shared for drives used support volume mapping -- installation requirements: windows 10: Build 14393 or later -- Hyper-V is required: (https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/quick-start-windows-10) -- Windows containters vice Linux (use linux containers -- uses Hyper V) https://docs.docker.com/docker-for-windows/install/ docker version (client, server, local registry) location of local registr/c/Users/Public/Documents/Hyper-V/Virtual hard disks 0.1 create an account on docker hub: (reference: https://www.docker.com/products/docker-hub) --------------------------------------------------------------------------------------- public registry for repositories https://hub.docker.com/ 0.2 log into the docker hub (public registry) ----------------------------------------- docker login --username=yourhubusername --email=youremail@company.com 0.3 *** start a linux image: attach stdin, stdout -i --interteractive --tty, pass a command: "bash" --------------------------------------------------------------------------------------------- docker run --interactive --tty ubuntu bash first run commands to show initial state --------------------------------------- docker images docker ps -a 1. demo # 1: run a simple linux container ---------------------------------------- docker run --name mike -i -t ubuntu bash cat /etc/issue echo "Hello CSE681 from Docker !!" > hello.txt open a cmd.exe window ------------------ docker exec mike ls && cat hello.txt docker stop mike exit container and commit changes to existing container to create a new container ------------------------------------------------------------------ docker ps -a docker commit mike mcorley/mikes_ubuntu docker rm mike docker ps -a -- compare the two images and have some fun examining layers docker images open firefox browser and navigate to the ubuntu repository, and view dockerfile: https://hub.docker.com/r/library/ubuntu/ --------------------------------------------------------------------------------------------------------------------- - docker history ubuntu:latest docker history mcorley/mikes_ubuntu -- open browser to mike's repository docker push mcorley/mikes_ubuntu docker images docker rmi mcorley/mikes_ubuntu docker images docker run --rm -i -t mcorley/mikes_ubuntu bash -- test switch to windows mode containers docker run -it microsoft/nanoserver cmd docker run --rm -i -t mcorley/mikes_ubuntu bash docker run --rm --platform linux -i -t mcorley/mikes_ubuntu bash docker images * switch back to linux containers docker images 2. demo # 2: define the docker file to build a firefox image. --------------------------------------------------------- Use case: never install apps directly on your host, run self contained apps via container images create a directory and write a single file named "Dockerfile" with no extension e.g. FROM ubuntu:14.04 RUN apt-get update && apt-get install -y firefox CMD /usr/bin/firefox *** to run the a Linux (Unbuntu) based container we need X Server (and X Launch (for config.) ---------------------------------------------------------------------------------------------- install VcXsrv (or Xming) -- open source windows X windows xerver implementation) https://sourceforge.net/projects/vcxsrv/ Source: https://dev.to/darksmile92/run-gui-app-in-linux-docker-container-on-windows-host-4kde copy the docker file into the build context, issue the build command, give the image a name (e.g. firefox) ------------------------------------------------------------------------------------------------------------ cd Dockerfile (directory) docker build -t firefox . (build context is the current directory . -- this a convention that is used) docker build -t mcorley/firefox:ubuntu-14.04 . -- push to mcorley repository on docker hub docker push mcorley/firefox:ubuntu-14.04 *** using powershell (as administrator) ------------------- cd .. Set-Variable -name DISPLAY -value 10.0.75.1:0.0 (your docker interface ip-address : device.display (0.0) docker run -d -v ${PWD}/firefox_rooted_path/downloads/:/root/Downloads -v ${PWD}/firefox_rooted_path:/root -ti --rm -e DISPLAY=$DISPLAY mcorley/firefox:ubuntu-14.04 -- version 2 cd Dockerfile2 docker build -t mcorley/firefox:v2 . docker run -e DISPLAY=$DISPLAY mcorley/firefox:v2 3. demo # 3: docker ------------------- *** start eclipse, exposed through vnc server docker run --rm --name vnc -d -p 5901:5901 kevensen/centos-vnc-eclipse *** pull an image from a repository ---------------------------------- docker pull microsoft/nanoserver docker mcorley/firefox:ubuntu-14.04 helpful sources --------------- https://github.com/moby/moby/issues/20397 Security warning source missing layers source https://docs.docker.com/v17.09/engine/userguide/storagedriver/imagesandcontainers/#container-size-on-disk -- test .net core cd C:\Users\mwcor\Desktop\net_core_project4\project4\net_core\DepAnal_core docker build -t mcorley/cse681-project3 . docker run --rm mcorley/cse681-project3 ./testdata/ *.cs