Added bind mount for docker.sock.

This commit is contained in:
David Ball 2024-05-31 02:57:54 -04:00
parent 81431c61b3
commit 43fb544744
6 changed files with 47 additions and 2 deletions

1
.env.example-linux Normal file
View File

@ -0,0 +1 @@
DOCKER_SOCK_PIPE=/var/run/docker.sock

1
.env.example-windows Normal file
View File

@ -0,0 +1 @@
DOCKER_SOCK_PIPE=//./pipe/docker_engine

8
.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

View File

@ -4,3 +4,32 @@ This repository creates the admin user interface which serves the following purp
- Enable contributors to spin up both a dev server to test their fork and a code server to edit their fork.
- Enable contributors to easily access both of these interfaces.
# Example Linux .env file
DOCKER_SOCK_PIPE=/var/run/docker.sock
# Example Windows .env file
DOCKER_SOCK_PIPE=//./pipe/docker_engine
# Create a .env file
Copy the Windows example .env file.
copy .env.example-windows .env
Copy the Linux example .env file.
cp .env.example-linux .env
# Use docker compose to bring up admin app
Using docker compose:
docker compose --env-file .env up --build -d
# Use docker compose to bring down admin app
Using docker compose:
docker compose down

View File

@ -1,4 +1,4 @@
const Docker = require('dockerode');
const docker = new Docker();
const docker = new Docker({socketPath: process.env.DOCKER_SOCK_PIPE||'/var/run/docker.sock'});
module.exports = docker;

View File

@ -1,11 +1,17 @@
# docker-compose.yml
version: '3'
services:
admin-app:
build: ./admin-app
env_file:
- .env
ports:
- "3000:3000"
volumes:
# - "/var/run/docker.sock:/var/run/docker.sock"
- "$DOCKER_SOCK_PIPE:$DOCKER_SOCK_PIPE"
admin-api:
build: ./admin-api
env_file:
- .env
ports:
- "3001:3001"