This guide covers installing Docker and Docker Compose. If you're looking for instructions for running Trigger.dev in docker, see here.
In the contributing guide of Trigger.dev, there's a section that requires you to start Docker.
If you don't have Docker installed on your machine, you'll run into some complications (errors).
Below are the steps on how you can avoid that.
First you need to setup docker-compose as it is an underlying tool that this command: pnpm run docker
fires behind the scene.
To install Docker Compose on Linux Ubuntu via the terminal, you can follow these steps:
-
Update the package index on your system by running the following command:
sudo apt update
-
Install the required dependencies by running the following command:
sudo apt install curl
-
Download the Docker Compose binary into the
/usr/local/bin
directory using thecurl
command:sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
-
Set the appropriate permissions to make the
docker-compose
binary executable:sudo chmod +x /usr/local/bin/docker-compose
-
Verify that Docker Compose has been successfully installed by running the following command:
docker-compose --version
This command should display the version information of Docker Compose without any errors.
After following these steps, you should have Docker Compose installed on your Ubuntu system, and you can use it by running docker-compose
commands in the terminal.
When you've verified that the docker-compose
package is installed and you proceed to start Docker with pnpm run docker
.
You'll probably get an error similar to the one below:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
ELIFECYCLE Command failed with exit code 1.
The error message suggests that the Docker daemon is not running on your system. The Docker daemon is responsible for managing and running Docker containers.
To resolve this issue, you may need to install Docker properly on your Ubuntu system. Here are the steps to install Docker on Ubuntu:
-
Update the package index on your system by running the following command:
sudo apt update
-
Install the necessary packages to allow apt to use repositories over HTTPS:
sudo apt install apt-transport-https ca-certificates curl software-properties-common
-
Add the official Docker GPG key to your system by running the following command:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
-
Add the Docker repository to the APT sources list:
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
-
Update the package index again:
sudo apt update
-
Install Docker by running the following command:
sudo apt install docker-ce docker-ce-cli containerd.io
-
After the installation is complete, verify that Docker is installed correctly by running the following command:
docker --version
This command should display the version information of Docker without any errors.
Once Docker is installed and verified, you should be able to start the Docker daemon and run the pnpm run docker
command without encountering any issues.
-
Download the Docker Desktop installer from the Docker website: Docker Desktop for Windows
-
Run the installer and follow the instructions to install Docker Desktop.
-
After installation, Docker Desktop should be running automatically.
-
Download the Docker Desktop installer from the Docker website: Docker Desktop for Mac
-
Run the installer and follow the instructions to install Docker Desktop.
-
After installation, Docker Desktop should be running automatically.
Please note that the instructions provided above are for the most common scenarios. For specific versions or different distributions, it's always a good idea to consult the official Docker documentation for the respective operating systems.