How To Install Docker Without Docker Desktop On Windows | by Paul Knulst | Apr, 2022

Additionally, discover ways to use Portainer in its place Docker GUI

Photo by Alesia Kazantceva on Unsplash
Picture by Alesia Kazantceva on Unsplash

As a developer who switched from Linux to Home windows due to many causes, I’ve used Docker Desktop for a number of months now as a result of it updates my Docker surroundings routinely.

Sadly, this isn’t doable anymore and I’ve to take away Docker Desktop.

Fortunately I didn’t use Docker Desktop for any instructions or performance apart from updating the Docker engine so this transformation won’t have an effect on my workflow.

Docker up to date its Docker Desktop License Agreement and allow the skilled use of Docker Desktop in massive organizations with out having a paid Docker subscription. Which means that if your organization has 250+ staff or greater than $10 million in annual income you’ll not in a position to make use of Docker Desktop with no paid subscription. It stays free for smaller firms, personal use, open-source initiatives, and academic functions.

This license replace is barely associated to Docker Desktop and to not Docker or the Docker Engine. This allows you to nonetheless use Docker for growth and all kinds of environments, together with the manufacturing ones. Usually, this license replace doesn’t impression your organization’s enterprise if working with Docker.

To observe this How-To it’s good to have a WSL2 appropriate workstation like Home windows 10 model 2004 or greater. To verify which model is put in press Home windows brand key + R and press Enter to indicate your system settings. If you don’t meet the requirement please replace your Home windows.

If Docker Desktop is put in you must uninstall it

In Home windows, the Linux Subsystem needs to be enabled. This may be performed by urgent the Home windows log key, typing “Flip Home windows options on and off” and open it.

Screenshot from Windows start menu taken by the author
Screenshot from Home windows begin menu taken by the creator

Scroll to the underside and activate the function whether it is deactivated.

Screenshot of Windows Features menu taken by the author
Screenshot of Home windows Options menu taken by the creator

After activating press OK and restart your pc.

It’s also possible to set up the Linux Subsystem with a PowerShell command:

Allow-WindowsOptionalFeature -On-line -FeatureName Microsoft-Home windows-Subsystem-Linux

After you arrange the prerequisite you must open a PowerShell with administrative privileges and set up Ubuntu in WSL2 with the next command:

wsl --set-default-version 2
wsl --install -d Ubuntu

It’s also possible to set up completely different Linux submodules inside this step.

After the set up is completed you need to verify if Ubuntu was put in within the right model:

wsl -l -v

If all the things labored appropriately you need to see your put in Ubuntu with the corresponding WSL model. If the model isn’t right you’ll be able to change it with:

wsl --set-version Ubuntu-YY.MM 2

YY.MM is the model of the Ubuntu model that you just put in lately.

To put in Docker on Home windows inside the Ubuntu submodule you’ll be able to observe the official steps for putting in Docker on Ubuntu:

One other means will probably be to create a brand new file and duplicate the next script into it. These instructions are solely copied from the official tutorial right into a file to share with fellow builders

Swap to your Ubuntu submodule inside the PowerShell and execute the file to put in Docker and the wanted dependencies.

Now you can begin and verify if all the things runs appropriately with:

sudo service docker begin   # begin the engine
sudo service docker standing # print some good standing info
docker run hello-world # run a check docker container

After the final command end, you need to see the operating Docker picture output:

Putting in Docker Compose may be performed inside the Ubuntu submodule. Open a PowerShell window and change to the Ubuntu submodule. Then obtain the newest launch from GitHub:

$ sudo curl -L https://github.com/docker/compose/releases/obtain/2.4.1/docker-compose-`uname -s`-`uname -m` -o /usr/native/bin/docker-compose

Subsequent, grant privileges for execution to the docker-compose command:

sudo chmod +x /usr/native/bin/docker-compose

Afterward, you’ll be able to check the performance by executing docker-compose -version inside the Ubuntu submodule or wsl docker-compose -version from any PowerShell window.

If you happen to observe the tutorial you need to have:

  1. WSL2 Linux subsystem put in
  2. Put in & configured Docker on Ubuntu
  3. Put in Docker Compose

You’ll be able to use all Docker instructions inside your Ubuntu submodule and likewise inside a PowerShell by previous the command with wsl:

wsl docker ps
wsl docker-compose -version

For comfort, you need to be capable to use any Docker command with out including wsl in entrance of it. To realize this you’ll be able to create an alias in your PowerShell. Read about it here and arrange all the things.

Then discover your PowerShell profile

echo $PROFILE

and open this file in an editor and paste this content material:

Operate Begin-WslDocker 
wsl docker $args

Operate Begin-WslDockerCompose
wsl docker $args
Set-Alias -Identify docker -Worth Begin-WslDocker
Set-Alias -Identify docker-compose -Worth Begin-WslDockerCompose

Save the file and restart your PowerShell terminal to check if the alias is working by typing:

docker ps
docker-compose -version

If you happen to don’t get an error it really works as anticipated.

To higher substitute Docker Desktop and have one thing like a Docker GUI you need to set up Portainer in your native surroundings.

Portainer is a strong, GUI-based Container-as-a-Service resolution that helps organizations handle and deploy cloud-native purposes simply and securely.

With Portainer you’ll be able to:

  1. Deploy purposes with outlined app templates (Click on to Deploy)
  2. Deploy and Handle Stacks from Compose recordsdata, together with deploying instantly from the git
  3. Deploy & Handle Containers, together with the power to edit a operating container
  4. Pull/Push/Construct Photos
  5. Create Networks
  6. Create/Delete Volumes
  7. See a log of Docker Occasions
  8. See docker engine (Host) info, and apply safety controls do you have to need

This Docker Compose file can be utilized to put in Portainer CE as a Docker service that routinely is restarted if it isn’t operating.

# docker-compose.yml 
model: '3'

companies:
portainer:
picture: portainer/portainer-ce:newest
container_name: portainer
restart: unless-stopped
security_opt:
- no-new-privileges:true
volumes:
- /and so forth/localtime:/and so forth/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./portainer-data:/information
ports:
- 9000:9000

Reserve it to any folder and run it in your PowerShell:

docker-compose up -d

Swap to your browser and open http://localhost:9000.

Timing Be aware: Be sure to log in and create your credentials quickly after Portainer is prepared, or it would routinely shut down itself for safety. If you happen to didn’t create the credentials on time and it shut down routinely, you must restart the service.

Execs

There are a number of benefits in comparison with the Docker Desktop model:

  1. The Docker engine is free. So the license replace received’t be any drawback in your growth and manufacturing surroundings.
  2. Portainer is a production-ready software program to handle your Docker surroundings that additionally typically is utilized in a server cluster surroundings.
  3. You’ll be taught Docker fundamentals a lot quicker and can acquire extra DevOps competencies.
  4. Usually manufacturing environments run in Linux so your growth surroundings comes near the manufacturing surroundings.

Cons

The one drawback for me is that you must replace it manually by your self as an alternative of urgent an “OK” button if a brand new model is accessible.

Thanks for studying this text!

I hope you loved studying it and at the moment are in a position to set up the Docker surroundings in your Home windows Host inside the Ubuntu submodule. Additionally, I hope you can now use and set up Portainer and Docker Compose on Home windows.

Wish to Join?If  be happy to attach with me on Twitter, LinkedIn, and GitHub!

More Posts