Quantcast
Viewing all articles
Browse latest Browse all 5979

Why is docker entrypoint not working for setting the OpenVPN password?

I have the following

services:  registry:    image: registry:2    ports:      - "5000:5000"    volumes:      - ~/.dr:/var/lib/registry  openvpn:    image: openvpn/openvpn-as    container_name: openvpn    ports:      - "1194:1194/udp"      - "943:943"      - "9443:9443"    restart: always    environment:      - OVPN_ADMIN_PASSWORD=${ADMIN_PASSWORD}    volumes:      - ~/.vpn/conf:/etc/openvpn      - ~/.vpn/startup.sh:/etc/vpn/startup.sh    entrypoint: ["/etc/vpn/startup.sh"]    cap_add:      - NET_ADMIN    sysctls:      net.ipv6.conf.all.disable_ipv6: 0      net.ipv6.conf.default.forwarding: 1      net.ipv6.conf.all.forwarding: 1

However, when I create the containers with docker-compose I get

2024-08-04 17:04:28 ERROR: --sock parameter ('/usr/local/openvpn_as/etc/sock/sagent.localroot', '/usr/local/openvpn_as/etc/sock/sagent') doesn't point to active socket: util/options:501,sagent/sacli:591,sagent/sacli:379,<string>:1,sagent/sagent_entry:68,sagent/sacli:1637,util/options:523,internet/base:1315,internet/base:1325,internet/base:991,util/options:501,sagent/sacli:591,sagent/sacli:379,util/error:110,util/error:91

And it fails to start I tried removing the entry point config and execing into to run manually and everything works fine but it doesn't seem to work with entrypoint. For reference the script is the following...

#!/bin/bash# Function to check if the OpenVPN Access Server is readyfunction check_server_ready {  local retries=10  local count=0  while [ $count -lt $retries ]; do    if /usr/local/openvpn_as/scripts/sacli status 2>&1 | grep -q "running"; then      return 0    fi    count=$((count + 1))    sleep 5  done  return 1}# Start OpenVPN Access Server/usr/local/openvpn_as/scripts/openvpnas &# Wait for the server to be readyif ! check_server_ready; then  echo "OpenVPN Access Server did not start successfully."  exit 1fi# Set the admin password using the environment variable/usr/local/openvpn_as/scripts/sacli -u openvpn --new_pass=$OVPN_ADMIN_PASSWORD SetLocalPassword# Ensure the user has admin privileges/usr/local/openvpn_as/scripts/sacli -u openvpn --key "type" --value "admin" UserPropPut# Keep the container runningtail -f /dev/null

I also tried

- ~/.vpn/startup.sh:/docker-entrypoint-initdb.d/startup.sh
-rwxr-xr-x  1 root     root      294 Aug  4 16:37 startup.sh

But this way also didn't work

What am I missing because running the script manually is not maintainable. Everything looks correct in terms of the ENV vars in exec and we know that is fine because it works manually.

What is going on?


Viewing all articles
Browse latest Browse all 5979

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>