Skip to content

Instantly share code, notes, and snippets.

@xaratustrah
Last active January 29, 2024 08:44
Show Gist options
  • Save xaratustrah/ac25e5b445bacd465a36470b0caae9ae to your computer and use it in GitHub Desktop.
Save xaratustrah/ac25e5b445bacd465a36470b0caae9ae to your computer and use it in GitHub Desktop.

Conda and Docker

Conda and Docker are essential for use in scientific environments. Both are open source software, but they include some optional add-ons that require licensing / payment, especially for large institutions. Nevertheless, it is easy to install and use all the features, as the optional tools are usually for convenience and support, but are not needed for actual operation.

Conda

Linux / OSX / Win

Conda can be easily installed using the newest Miniforge. It is a clean local installation and will not pollute your system and does not need additional rights. It sets the default channels to the non-commercial / open source ones automatically.

Just download the latest Miniforge3 from the above link, then run the installation. You can make sure PATH is set, for more convenience.

You will have conda and mamba as command lines and can use them interchangably, e.g. by creating an environment and use it, for example:

mamba create -n my_env
mamba activate my_env
mamba install -y python=3.10 root pyqt pyfftw

Docker

Only Docker-Desktop which is the GUI is subject to licensing issues. The other two main components, Docker CLI and Docker Engine itself are open source software.

You can use Docker by installing the two main components, without the GUI. But while Docker CLI runs on every platform, Docker Engine itself runs only on Linux.

This makes it easy for Linux users, but for OSX and Windows, one needs an additional layer that mimics a virtual machine. This was the job of Docker-Desktop, but since we do not want to use it, we need a replacement.

Uninstall existing Docker

If you have Docker-Desktop installed, you can uninstall it first. Please refer to this page or here for Mac.

OSX

Brew installer

Brew is a nice universal tool to install things on OSX. It has a clean structure and will not pollute your system. If you don't have it, you can install it with one single command. Please refer to Brew homepage. Also here you need to make sure the paths are set properly, for example by putting this at the end of your .bash_profile:

export PATH="/opt/homebrew/sbin:/opt/homebrew/bin:$PATH"

You can check your installation by:

brew doctor

Replacement for Docker-Desktop

There are many drop-in replacements for Docker-Desktop, such as minikube, colima etc... More information can be found here.

The installation of colima is quite quick, as written in more detail here. Here a quick review:

brew install docker docker-compose docker-credential-helper colima

open the file nano ~/.docker/config.json and put this:

{
        "auths": {},
        "credsStore": "osxkeychain",
        "currentContext": "colima"
}

then start colima by using the following command (later you can also stop it):

colima start

now you can use your standard Docker activities, such as:

docker run --rm -it ubuntu

Linux (e.g. Ubuntu)

TBD

Windows (WSL)

TBD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment