Merge pull request #8410 from SuperTux88/allow-DOCKER_HOST-env-var

Allow DOCKER_HOST env var for diaspora-dev docker setup
This commit is contained in:
Benjamin Neff 2023-06-04 21:34:23 +02:00
commit e29f9e2fa2
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
2 changed files with 4 additions and 2 deletions

View file

@ -1,4 +1,4 @@
FROM amd64/ruby:2.7-slim-bullseye
FROM docker.io/amd64/ruby:2.7-slim-bullseye
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update && \

View file

@ -179,8 +179,10 @@ print_usage_full() {
# ----- Helper functions -----
dia_docker_compose() {
local docker_socket="${DOCKER_HOST:-"unix:///var/run/docker.sock"}"
docker_socket="${docker_socket#unix://}"
# Check permissions of docker socket and use sudo if needed
if [ -r "/var/run/docker.sock" ] && [ -w "/var/run/docker.sock" ]; then
if [ -r "${docker_socket}" ] && [ -w "${docker_socket}" ]; then
docker-compose "$@"
else
echo "Attention: Docker socket not writable, using sudo for the docker command. You might be asked for your password now." >&2