Step-by-Step: Setting Up Draw.io Using Docker Compose

Step-by-Step: Setting Up Draw.io Using Docker Compose

Installing Draw.io using Docker Compose is a straightforward way to manage and run this diagramming tool. Docker allows you to isolate Draw.io in a container, making it easier to manage dependencies and updates. This guide will walk you through each step of the installation process, ensuring that you can set up and run Draw.io on your system efficiently.

What Is Draw.io?

Draw.io is a popular online diagramming tool used to create flowcharts, network diagrams, UML diagrams, and more. It’s widely used because it’s free, intuitive, and powerful. By using Docker, you can run Draw.io on your local machine or server without needing to install anything directly on your system except Docker itself.

Prerequisites

Before you begin, ensure that you have the following installed on your machine:

  1. Docker: Docker is essential for running containers.
  2. Docker Compose: Docker Compose simplifies the management of Docker containers, especially when dealing with multiple services. It usually comes with Docker, but you can also install it separately if needed.

Step 1: Verify Docker Installation

To confirm that Docker is installed, open your terminal and run:

codedocker --version

You should see the installed Docker version. Similarly, check Docker Compose by running:

codedocker-compose --version

If both commands return version numbers, you’re ready to proceed.

Step 2: Create a Docker Compose File

Create a Directory for Draw.io:

First, create a directory to store your Docker Compose file:

mkdir drawio
cd drawio

2. Create the docker-compose.yml File:

Within the drawio directory, create a docker-compose.yml file using your favorite text editor:

nano docker-compose.yml

Add the following content to the file:

version: '3.3'

services:
  drawio:
    image: fjudith/draw.io
    container_name: drawio
    ports:
      - "8080:8080"
    restart: unless-stopped

Run Docker Compose

Now that your docker-compose.yml file is ready, you can use Docker Compose to start the Draw.io container.

  1. Start the Draw.io Container:In the terminal, ensure you’re in the drawio directory and run:
docker-compose up -d

The -d flag runs the container in detached mode, meaning it will run in the background.

2. Check the Container Status:

To verify that the container is running correctly, use the following command:

docker ps

Access Draw.io

With the container running, you can now access Draw.io from your web browser.

  1. Open Your Browser:Open your web browser and go to:
http://SERVER_IP:8080

If you changed the host port in the docker-compose.yml file, replace 8080 with your chosen port.

Start Using Draw.io:

The Draw.io interface should load in your browser. You can now start creating diagrams, flowcharts, or any other visual content you need.

Managing the Container

Docker and Docker Compose make it easy to manage the Draw.io container. Here are some basic commands:

  1. Stopping the Container:If you need to stop the Draw.io container, run:docker-compose down This command stops and removes the container but keeps the docker-compose.yml file intact.
  2. Restarting the Container:To restart the container after stopping it, simply run:docker-compose up -d
  3. Viewing Logs:If you want to check the logs for the Draw.io container, use:docker-compose logs This can help you troubleshoot any issues.

Conclusion

By following these steps, you can easily install and manage Draw.io using Docker Compose. This setup provides a clean, isolated environment for Draw.io, making it easy to maintain and update. Whether you’re using Draw.io for personal projects or in a team environment, Docker Compose ensures that your setup is reliable and straightforward to manage.

Enjoy creating your diagrams with the powerful and flexible Draw.io tool!

Fedya Serafiev

Fedya Serafiev

Fedya Serafiev owns the website linuxcodelab.eu. He finds satisfaction in helping people solve even the most complex technical problems. His current goal is to write easy-to-follow articles so that such problems do not arise at all.

Thank you for reading the article! If you found the information useful, you can donate using the buttons below: