How-to install Docker, docker-compose, and Nginx Proxy Manager on Ubuntu

This guide is good just for setting up Docker and Docker-compose as well. No need to install Nginx Proxy Manager if you want to install something else. Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers.Docker-compose is a tool for defining and running multi-container Docker applications. Nginx Proxy Manager enables you to easily forward to your websites running at home or otherwise, including free SSL, without having to know too much.

Note, you should already have DNS ‘A’ record created to point to your if you want to use DNS. You still do everything IP-based if you want.

Reference Links:

Lets SSH into our server.

ssh user@IP

Make sure server is up to date.

sudo apt update && sudo apt upgrade -y

Reboot server

sudo reboot

If you are running a Ubuntu 16.04 or older, let us get an upgrade to at least 18.04 LTS. You can skip this step if you are already running 18.04 LTS or newer.

sudo do-release-upgrade

Install prereqs

sudo apt install apt-transport-https ca-certificates curl software-properties-common

Add Docker GPG key.

curl -fsSL | sudo apt-key add -

Let’s add Docker Repository.

sudo add-apt-repository "deb [arch=amd64] focal stable"

Let update the repository list.

sudo apt update

Let’s verify the repository cache for Docker.

apt-cache policy docker-ce

We now will install Docker.

sudo apt install docker-ce -y

Let’s verify the Docker version.

docker -v

Let’s add our user to the Docker group.

sudo usermod -aG docker ${USER}

Now let’s install docker-compose.

sudo apt install docker-compose -y

Let’s verify our docker-compose version.

docker-compose -v

Now we have officially installed Docker and docker-compose. If you want to proceed in installing your own proxy, continue with this guide. 

Let’s create a directory in /opt/nginixpm

sudo mkdir /opt/nginxpm

Let’s open the working directory of /opt/nginixpm.

cd /opt/nginxpm

Now we will create Nginix Proxy Manager docker-compose file ‘docker-compose.yml’.

sudo nano docker-compose.yml

Add the following contents in that file and save. Make sure to swap out ‘VeryStrongPassword12345’ with a strong password. Note, DB_MYSQL_PASSWORD and MYSQL_PASSWORD, should be the same/match password.

version: '3'
    image: 'jc21/nginx-proxy-manager:latest'
      - '80:80'
      - '81:81'
      - '443:443'
      DB_MYSQL_HOST: "db"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: "drew"
      DB_MYSQL_PASSWORD: "VeryStrongPassword12345"
      DB_MYSQL_NAME: "npm"
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    image: 'jc21/mariadb-aria:10.4'
      MYSQL_ROOT_PASSWORD: 'VeryStrongPassword12345'
      MYSQL_DATABASE: 'npm'
      MYSQL_USER: 'drew'
      MYSQL_PASSWORD: 'VeryStrongPassword12345'
      - ./data/mysql:/var/lib/mysql

Now let us create Nginix Proxy Manager in Docker with that docker-compose file we just created.

sudo docker-compose up -d

You should not its finished installing by seeing the following.

Creating npm_db_1  ... done
Creating npm_app_1 ... done

You should now be able to check if running in a web browser. Visit your

Admin page is

Your first time login will be the following.

password: changeme

After initial login make sure to change your username and password.

You now have Docker and docker-compose installed on your VPS. If you installed Nginx Proxy Manager, you have created your first app in a Docker container in which you can run your own proxy to protect your web application(s).

Hope you enjoyed this as much as I have!

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on pinterest