---
# System prepended metadata

title: Install Docker & Docker Machine on Ubuntu 19.04

---

# Install Docker & Docker Machine on Ubuntu 19.04


Docker & Docker Compose installation guide for debian-based systems. 

## Install: docker

Install docker using the official [docker install](https://github.com/docker/docker-install) script: 

```commandline
$ curl -fsSL get.docker.com | sudo sh
```

You should be able to run: `docker --version`

Now, let's enable managing docker as non-root:

1. Create the docker-group (might exists already): `sudo groupadd docker`
1. Add current user to the group: `sudo usermod -aG docker $USER`
1. Group membership re-evaluation: `newgrp docker`

You should be able to run the classic "hello world" image: 

```commandline
$ docker run hello-world
```

**Recommended**: Enable docker to start on-boot by running `sudo systemctl enable docker`. 


## Install: docker-compose

Check the lastest relase on the [office github page](https://github.com/docker/compose/releases). 

Download with `curl`: 

```commandline
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
```

Give compose executable permissions: 

```commandline
$ sudo chmod +x /usr/local/bin/docker-compose
```

Test by getting the version:

```commandline
$ docker-compose --version
```

**Recommended**: Install the [command completition](https://docs.docker.com/compose/completion/) options.


## Example

See a comprehensive example on how to use docker & docker-compose in [this blogpost](https://rhdzmota.com/post/docker-and-docker-compose-example/).


## References

* https://github.com/docker/docker-install
* https://docs.docker.com/install/linux/linux-postinstall/






## Long way? 

Determine your cpu architecture (e.g. x86_64):

```commandline
$ lscpu | grep Architecture
```

Now download the lastest docker version available for your architecture from [this page](https://download.docker.com/linux/static/stable/). You can use either the UI or via `curl`: 

```commandline
curl -L -o /tmp/docker.tgz https://download.docker.com/linux/static/stable/x86_64/docker-18.09.7.tgz
```

Install docker:

```commandline
$ tar xvzf /tmp/docker.tgz -C /tmp && \ 
    sudo mv /tmp/docker/* /usr/bin
```

Docker is now installed in your system `docker --help` but network controller might not be configured yet. 


Configure the [network controller](https://github.com/docker/for-linux/issues/123): 

```commandline
$ sudo ip link add name docker0 type bridge 
$ sudo ip addr add dev docker0 172.17.0.1/16
```

Now manually start the docker deamon by typing: 

```commandline
$ sudo dockerd
```

You should be able to: 

```commandline
$ sudo docker ps 
```


And unmask the docker service with `systemctl`: 

```commandline
$ sudo systemctl unmask docker.socket
$ sudo systemctl start docker.service
```

## Docker Compose

See the latest release from this github page. 

Download with `curl`: 

```commandline
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
```

Give compose executable permissions: 

```commandline
$ sudo chmod +x /usr/local/bin/docker-compose
```

Test by getting the version:

```commandline
$ docker-compose --version
```

You can install [command completition](https://docs.docker.com/compose/completion/).

## References

https://docs.docker.com/install/linux/docker-ce/ubuntu/

https://askubuntu.com/questions/1030179/package-docker-ce-has-no-installation-candidate-in-18-04

https://docs.docker.com/machine/install-machine/

https://itsfoss.com/dpkg-returned-an-error-code-1/ 

https://medium.com/@Grigorkh/how-to-install-docker-on-ubuntu-19-04-7ccfeda5935

https://containerd.io/downloads/

https://www.linux.com/learn/understanding-and-using-systemd 

https://download.docker.com/linux/static/stable/x86_64/

https://github.com/docker/for-linux/issues/123 

https://stackoverflow.com/questions/37227349/unable-to-start-docker-service-in-ubuntu-16-04
