Skip to main content
  • GoDaddy Community
  • VPS & Dedicated Servers
  • VPS & Dedicated Servers

    cancel
    Showing results for 
    Show  only  | Search instead for 
    Did you mean: 
    davisdre317
    Super User I

    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 docks.domain.com if you want to use DNS. You still do everything IP-based if you want.

    Reference Links:
    https://www.docker.com/
    https://docs.docker.com/compose/
    https://nginxproxymanager.com/

     

     

    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 https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

     

    Let's add Docker Repository.

    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu 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'
    services:
      app:
        image: 'jc21/nginx-proxy-manager:latest'
        ports:
          - '80:80'
          - '81:81'
          - '443:443'
        environment:
          DB_MYSQL_HOST: "db"
          DB_MYSQL_PORT: 3306
          DB_MYSQL_USER: "drew"
          DB_MYSQL_PASSWORD: "VeryStrongPassword12345"
          DB_MYSQL_NAME: "npm"
        volumes:
          - ./data:/data
          - ./letsencrypt:/etc/letsencrypt
      db:
        image: 'jc21/mariadb-aria:10.4'
        environment:
          MYSQL_ROOT_PASSWORD: 'VeryStrongPassword12345'
          MYSQL_DATABASE: 'npm'
          MYSQL_USER: 'drew'
          MYSQL_PASSWORD: 'VeryStrongPassword12345'
        volumes:
          - ./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 docks.domain.com.

     

    Admin page is docks.domain.com:81

     

    Your first time login will be the following.

    email: admin@example.com
    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!


    Very Respectfully,

    Drew Davis
    Navy Veteran and Entrepreneur | GoDaddy Pro user | "Proud to be serving others!"

    *** Please note that I offer free advice on this forum. Please feel free to give me KUDOS on this topic/discussion; mark my comment as ACCEPTED SOLUTION if you believe I've helped solved your issue. Thanks! ***
    0 REPLIES 0