Docker CE vs Docker EE
Docker CE is Community Edition which is free but EE is Enterprise Edition which is not free. In EE , you get support and more products.
Checkout the pricing: https://www.docker.com/pricing/
Installing Docker
If you don't already have Docker installed, Docker already has some great guides on how to do it, but if you already know which OS you want to install on, below are quicker steps for downloading it. The videos after this Lecture are walkthroughs of installing Docker for each OS, then getting the GitHub repo, getting a code editor, and tweaking the command line if you want to. Feel free to skip any of this Section if you have Docker Desktop and Visual Studio Code installed.
I always recommend Visual Studio Code (vscode) as your editor for all things Docker, Kubernetes, and DevOps. It's free for all OSs and has plugins to help you with many tools in this course.
Installing on Windows 10 and Windows 11 (any Edition)
https://docs.docker.com/desktop/windows/install/
This is the best experience on Windows, which uses WSL2. If you're new to WSL2, it's the best way to run Linux on Windows, and Docker Desktop will walk you through enabling it. Docker can technically still work on Hyper-V with "Windows Containers", but most of this course focuses on Linux Containers, which WSL2 is great at.
After installing Docker Desktop for Windows. I recommend installing a Windows Store Ubuntu for WSL2 distro and using its shell in Windows Terminal is the best CLI experience! Make sure to check your Docker Desktop settings to give it enough resources and enable all your WSL2 distros for Docker Desktop.
Installing on Windows 7 or Windows 8
Unfortunately, Microsoft's OS features for Docker Desktop don't work in these older versions. You'll need to use Hyper-V or install VirtualBox and manually setup a Linux VM. It's more involved than the other options, so I often recommend the easier option: using a DigitalOcean cloud server with my coupon code https://m.do.co/c/b813dfcad8d4 gets you $100 in credits over 60 days.
Installing on Mac
https://docs.docker.com/desktop/mac/install/
You'll want to install Docker Desktop for Mac, which is great.
Installing on Linux
https://docs.docker.com/engine/install/
Do not use your built-in default packages like apt/yum install docker.io
because those packages are old and not the Official Docker-Built packages.
I prefer to use Docker's automated script to add their repository and install all dependencies: curl -sSL https://get.docker.com/ | sh
but you can also install in a more manual method by following specific instructions that Docker provides for your Linux distribution.
Use Play With Docker
https://labs.play-with-docker.com/
Maybe you don't have local admin, or maybe your machine doesn't have enough resources. Well, the best free option here is to use play-with-docker.com, which will run one or more Docker instances inside your browser, and give you a terminal to use it with. You can create multiple machines on it, and even use the URL to share the session with others in a sort of collaborative experience. I highly recommend you check it out. Most of the lectures in this course can be used with "PWD", but the big limitation is it'll reset after 4 hours, at which time it'll delete your servers.
Use DigitalOcean
If you signup for a new account with DigitalOcean, my favorite "simpler" cloud, you can use a smaller server for months with my signup credit. Install Docker in the Cloud, via the above Linux links, and do the course without needing Docker locally. Thousands of students have done this:
https://m.do.co/c/b813dfcad8d4 gets you $100 in credits over 60 days
Check your docker version
Let' check our docker version
docker version
Also check some information:
docker info
You may also see all the commands of docker:
docker
Also, we need to know the formats because there are actually lots of commands:
Image vs Container
Image is binaries of applications
Container means the running image
Let's run a container:
docker container run --publish 80:80 nginx
You can see what actually happened:
Now go to your browser and type localhost
You can see something like this.
Also, open the docker hub and you can see something like this
Press Ctrl + C to stop the container.
Also type
to see the unique container ID which is still there . Now go to browser and you will still see the nginx website.
Now type
docker container ls
You will see the containers still running and you will notice that this container id is same as we saw from the last command.
Now lets stop it
docker container stop <1st few digits of the id>
now check the containers
docker container ls
You will find nothing.
docker container ls -a
Also into the docker desktop, you will find this
Now, you will find 2 containers. Why?
Because
We have used the command docker container run
twice . Each time we run that command, it creates a container from the image (nginx) .
Also, you can see Container name which we never set but docker did by itself. Now, lets set that and create a new container
docker container run --publish 80:80 --detach --name mitulhost nginx
Now, lets see the container list again
Now, lets go to the localhost and refresh it to generate some logs . Then go to the terminal and them type
docker container logs mitulhost
Now, lets delete our containers
To remove a container , we nee to type:
docker container rm <1st few digits of container 1> <1st few digits of container 2> ...
But this only works for the stopped container. As, we have "mitulhost" container already running, we can stop it and run it.Or,else we can force it to be removed.
docker container rm -f <1st few digits of container