Skip to content

Instantly share code, notes, and snippets.

@rstacruz rstacruz/README.md
Last active Nov 17, 2019

Embed
What would you like to do?
How to install Docker in Mac, Windows, and Linux

Getting Docker

Docker is available for Linux, MacOS, and Windows.

MacOS

Docker for Mac is best installed with Homebrew and Homebrew Cask. For other ways to install on MacOS, see Install Docker for Mac in Docker's docs.

brew cask install docker       # Install Docker
open /Applications/Docker.app  # Start Docker

💡 Tip: Avoid Docker Toolbox and boot2docker. These are older packages that have been ceded by Docker for Mac.

Arch Linux

Docker is available in Arch Linux's repositories. Also see Docker in ArchWiki.

sudo pacman -Syu docker        # Install Docker
sudo systemctl start docker    # Start Docker

Ubuntu

docker.io is available from the Ubuntu repositories (as of Xenial).

# Install Docker
sudo apt install docker.io
sudo apt install docker-compose

# Start it
sudo systemctl start docker

💡 Tip: If the docker.io package isn't available for you, see Get Docker CE for Ubuntu for an alternative.

Windows

Install Windows Subsystem for Linux and choose Ubuntu as your guest OS. Install Docker as you normally would on Ubuntu (see above). After that, see these instructions for info on how to get it running.

💡 Tip: Avoid Docker for Windows. While it works in most cases, you'll still face NTFS limitations without WSL (eg, lack of symlinks, which is needed for Yarn/npm to work).

Other OS's

For other operating systems, see: https://www.docker.com/community-edition#download

Verifying if it works

If everything works, you should have the following commands available:

$ docker info
Containers: 0
Running: 0
Paused: 0
...
$ docker-compose --version
docker-compose version 1.21.2, build unknown

Starting Docker

If you get an error like the one below, you might need to start the Docker daemon.

$ docker info
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

To start the Docker daemon, it probably needs one of these commands

open /Applications/Docker.app  # macOS
sudo systemctl start docker    # Arch, Ubuntu, CentOS

Enabling on startup

For Arch Linux, Ubuntu and CentOS, this will enable auto-starting of the Docker service:

sudo systemctl enable docker
@karlhorky

This comment has been minimized.

Copy link

karlhorky commented Oct 16, 2019

It seems like docker-compose doesn't work on WSL with the current version of these instructions (further down in your link mentions the issue: microsoft/WSL#2291 (comment))

Tracking this issue a bit to the root cause leads to microsoft/WSL#767 (comment), which recommends this blog post, which looks good: https://medium.com/faun/docker-running-seamlessly-in-windows-subsystem-linux-6ef8412377aa

The recommendations in the blog post are mirrored by the official documentation, which also uses docker-ce instead of docker.io: https://docs.docker.com/install/linux/docker-ce/ubuntu/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.