Setting up Docker
This guide is to assist with the installation of docker (OSS Variant) and some of the docker cli tools. It is not meant to replace other online articles but more of a cheat sheet to getting your setup up and running as fast as possible. If you encounter issues with the setup, please search online for a fix.
Installation​
MacOS (amd64/arm64)​
There are different ways to install the docker engine on MacOS, however this guide will focus on using colima which uses limactl under the hood to create a virtual machine and supporting functionality such as automatic port forwarding.
-
Install homebrew. You can also install homebrew without
sudorights using this guidetipMake sure you read the homebrew instructions which are printed out on the console as it will guide you to the additional setup steps.
-
Install colima and the docker cli
brew install colimainfoThe installation will take a while as it will have to compile various dependencies.
-
Install the docker cli tools
brew install docker docker-compose docker-credential-helperThen configure
docker-composeas a docker plugin so that you can usedocker composeinstead of the legacydocker-composescript.mkdir -p ~/.docker/cli-plugins
ln -sfn $(brew --prefix)/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose -
Configure and start
colimacolima start --cpu 4 --memory 8info- The extra arguments are only needed the first time you start it. You can change the settings to based on what you are need/have.
- You can adjust the number of CPUs and amount of RAM used by colima to suite your machine
- You will have to start
colimaeach time your machine is restarted (as it is not configured to autostart, though there are ways on MacOS to do this)
-
Check that everything is working by starting the
hello-worldcontainerdocker run -it --rm hello-world
References
Windows (WSL2)​
If you are using Windows, it is recommended to use WSL2 to run your a Ubuntu distribution where docker-ce is installed within it. Please do not bother with Docker Desktop or any other "Desktop" related product (e.g. Rancher Desktop). It will save you a lot of hassle by using the native docker-ce version inside the WSL2 distribution itself.
Once you have a Ubuntu distribution running under WSL2, follow the instructions under the Linux installation section.
Linux​
Checkout the online documentation how to install the docker engine (docker-ce) on your linux distribution. Don't forget to run the Linux postinstall instructions to enable docker to be controlled by non-root linux user.
The following steps should be executed:
- Install docker-ce
- Install docker compose plugin
- Run docker-ce post installation instructions
After the install verify that everything is working correctly by running the following commands
-
Check docker
docker run -it --rm hello-world -
Verify that the
docker composeplugin was configured correctlydocker compose --help
Troubleshooting​
Some typical problems can be found here. Remember, if you don't find your error then please search online using your preferred search engine.
Invalid​
Check the docker config file ~/.docker/config.json. The credential manager setting (credsStore) should be set to osxkeychain.
Example: ~/.docker/config.json
{
"auths": {},
"credsStore": "osxkeychain",
"currentContext": "colima"
}