Testimonials
What our customers say about Team Password Manager

How to create a full Team Password Manager installation with Docker Compose

Current Team Password Manager version: 13.166.291

The Team Password Manager Docker image comes without MySQL, so to create a Team Password Manager installation with it you need to provide one. Why not use Docker for this too?

In this document we're going to create a full Team Password Manager installation using Docker with two containers: one with Team Password Manager and another one with MySQL. To do it we'll use Docker Compose, a Docker application used to "orchestrate" containers for multi-container applications.

To follow this tutorial you'll need to have Docker and Docker Compose installed on your server. You'll find the links to do so in the Docker introduction document. After you've installed them, follow these steps:

  1. Create the docker-compose.yml file
  2. Execute docker-compose to run the application
  3. Execute the Team Password Manager installer
  4. Stop/restart/delete the installation

1. Create the docker-compose.yml file

The docker-compose.yml file is a text file that describes our Docker application. In this case, our application has two containers: one with Team Password Manager and all the required components to run it (Apache, PHP, SourceGuardian/Ioncube and settings) and another one with the MySQL database server.

Create a folder on your system, let's call it tpm_docker and place the following docker-compose.yml file in it:

# Team Password Manager Docker Compose file
# More information: https://teampasswordmanager.com/docs/docker/

services:

  teampasswordmanager:
    image: teampasswordmanager/teampasswordmanager:latest
    depends_on:
      - mysql
    restart: always
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - tpm_volume:/var/www/html
    networks:
     - tpm_network
    environment:
      - TPM_SERVER_TIMEZONE=Etc/UTC
      - TPM_PHP_TIMEZONE=Etc/UTC
      - TPM_ENCRYPT_DB_CONFIG=0
      - TPM_CONFIG_HOSTNAME=mysql
      - TPM_CONFIG_PORT=3306
      - TPM_CONFIG_USERNAME=tpm_user
      - TPM_CONFIG_PASSWORD=tpm_password
      - TPM_CONFIG_DATABASE=tpm_database
      - TPM_UPGRADE=0

  mysql:
    image: mysql:5.7
    restart: always
    ports:
      - "13306:3306"
    volumes:
      - tpm_mysqldata:/var/lib/mysql 
    networks:
     - tpm_network
    environment:
      - MYSQL_USER=tpm_user
      - MYSQL_PASSWORD=tpm_password
      - MYSQL_DATABASE=tpm_database
      - MYSQL_ROOT_PASSWORD=password5.7

networks:
  tpm_network:
    driver: "bridge"

volumes:
  tpm_mysqldata:
    driver: "local"
  tpm_volume:
    driver: "local"

Download docker-compose.yml


Our docker-compose.yml contains some variables that you can change (see Environment variables), but for now you can leave them as they are. Except if you're already running a web server in your system. In this case you should change the "ports" section of the "teampasswordmanager" service. Where it says "80:80", change it to "8080:80" and where it says "443:443" change it to "8443:443".

2. Execute docker compose to run the application

Open up a terminal on your system and go to the folder you created in the previous step (tpm_docker). There, enter this command:

docker compose up -d

If everything is correct you should see an output similar to this one:

Docker Compose Output

If you see the last two lines that end in "...done" it means the application is running, congratulations!

To summarize, this is what has happened: Docker has downloaded the images for Team Password Manager and MySQL, has created a container for each one of them and has run them in an isolated network.

You can see the containers by executing this command: docker compose ps. You should see something like this:

Docker Compose ps

tpm_docker_mysql_1 is the container that runs MySQL and tpm_docker_teampasswordmanager_1 is the container that has the Team Password Manager application.

3. Execute the Team Password Manager installer

To conclude the installation of Team Password Manager you should execute the Team Password Manager installer. To do this:

• Open your browser and go to http://localhost/index.php/install. You can replace "localhost" with the IP address of your server or the domain/subdomain that points to it, if you have it configured. If you changed the ports in the docker-compose.yml file you should use this url: http://localhost:8080/index.php/install. Note also that we've used "http" and not "https" in this case. We explain how to configure https in this document: "How to install a https commercial certificate in a Docker container".

• Fill in the data in the Team Password Manager installer screen and click on "Submit data to complete installation".

Docker Team Password Manager installer

Stop/restart/delete the installation

If you want to stop the installation you have two options:

docker compose down (from the same folder you executed docker compose up -d): this will stop the containers and delete them. If you want to start the installation again you'll need to execute docker compose up -d again.

docker compose stop (from the same folder you executed docker compose up -d): this will just stop the containers. To start the application again enter: docker compose start.


Document changelog

Oct 9, 2024: Take out version field from the docker-compose.yml file
Take out the hyphen in docker compose commands
Nov 18, 2020: Document created
Questions or Problems? Please contact our support department