osixia / docker-openldap-backup

A docker image to run OpenLDAP, and make periodic backups 🐳
MIT License
98 stars 43 forks source link

docker container stucks in `restarting` #15

Open hwdevops opened 2 years ago

hwdevops commented 2 years ago

I have the issue that the docker container is stuck in restaring after docker-compose down and docker-compose up -d.

CONTAINER ID   IMAGE                                    COMMAND                  CREATED          STATUS                         PORTS                                       NAMES
44bf1c1e0fee   osixia/openldap-backup:1.5.0             "/container/tool/run"    21 seconds ago   Restarting (1) 2 seconds ago                                               openldap

The compose file looks like:

version: "3.5"
services:
  openldap:
    restart: unless-stopped
    image: osixia/openldap-backup:1.5.0
    networks:
      - docker-netzwerk
    container_name: openldap
    environment:
      - TZ=Europe/Berlin
      - MAX_UPLOAD_SIZE=100M
      - LDAP_ORGANISATION=${LDAP_ORGANISATION}
      - LDAP_DOMAIN=${LDAP_DOMAIN}
      - LDAP_CONFIG_PASSWORD=config
      - LDAP_ADMIN_PASSWORD=${LDAP_ADMIN_PASSWORD}
      - BASE_DN=${BASE_DN}
      - ENABLE_READONLY_USER=false
      - READONLY_USER_USER=reader
      - READONLY_USER_PASS=reader
      #      - NETWORK_ACCESS=internal
      - LDAP_OPENLDAP_UID=1012
      - LDAP_OPENLDAP_GID=1000
      - LDAP_BACKEND=mdb
      - LDAP_BACKUP_CONFIG_CRON_EXP=0 4 * * *
      - LDAP_BACKUP_DATA_CRON_EXP=0 4 * * * # 4:00h am
      - LDAP_BACKUP_TTL=90 # 90 Tage vorhalten
    ports:
      - 389:389
    volumes:
      - ./backup:/data/backup
      - ./var/lib/ldap:/var/lib/ldap
      - ./etc/ldap/slapd.d:/etc/ldap/slapd.d

  phpldapadmin:
    restart: unless-stopped
    image: osixia/phpldapadmin:0.9.0
    container_name: phpldapadmin
    networks:
      - docker-netzwerk
    links:
      - openldap
        #    ports:
        #      - 6443:443
    environment:
      #  - MAX_UPLOAD_SIZE=100M
      - VIRTUAL_HOST=${VIRTUAL_HOST}
      - CERT_NAME=shared
      - VIRTUAL_PROTO=https
      - VIRTUAL_PORT=443
      - PHPLDAPADMIN_LDAP_HOSTS=openldap
      - NETWORK_ACCESS=internal
    # - PHPLDAPADMIN_HTTPS=false
    volumes:
      - ./phpldapadmin/:/container/service/phpldapadmin/assets/config/
      - ./php.ini:/etc/php/7.3/cli/php.ini
      - ./php.ini:/etc/php/7.3/fpm/php.ini

networks:
  docker-netzwerk:
    external:
      name: docker-netzwerk

And the logs look like

PS C:\Users\xgvnhow\Documents\Git-RD\docker-files-prod-B\openldap> docker logs openldap
***  INFO   | 2022-07-14 15:18:50 | CONTAINER_LOG_LEVEL = 3 (info)
***  INFO   | 2022-07-14 15:18:50 | Search service in CONTAINER_SERVICE_DIR = /container/service :
***  INFO   | 2022-07-14 15:18:50 | link /container/service/:cron/startup.sh to /container/run/startup/:cron
***  INFO   | 2022-07-14 15:18:50 | link /container/service/:cron/process.sh to /container/run/process/:cron/run
***  INFO   | 2022-07-14 15:18:50 | link /container/service/:logrotate/startup.sh to /container/run/startup/:logrotate
***  INFO   | 2022-07-14 15:18:50 | link /container/service/:ssl-tools/startup.sh to /container/run/startup/:ssl-tools
***  INFO   | 2022-07-14 15:18:50 | link /container/service/:syslog-ng-core/startup.sh to /container/run/startup/:syslog-ng-core
***  INFO   | 2022-07-14 15:18:50 | link /container/service/:syslog-ng-core/process.sh to /container/run/process/:syslog-ng-core/run
***  INFO   | 2022-07-14 15:18:50 | link /container/service/slapd/startup.sh to /container/run/startup/slapd
***  INFO   | 2022-07-14 15:18:50 | link /container/service/slapd/process.sh to /container/run/process/slapd/run
***  INFO   | 2022-07-14 15:18:50 | link /container/service/slapd-backup/startup.sh to /container/run/startup/slapd-backup
***  INFO   | 2022-07-14 15:18:50 | Environment files will be proccessed in this order :
Caution: previously defined variables will not be overriden.
/container/environment/98-default/default.yaml
/container/environment/99-default/default.startup.yaml
/container/environment/99-default/default.yaml

To see how this files are processed and environment variables values,
run this container with '--loglevel debug'
***  INFO   | 2022-07-14 15:18:50 | Running /container/run/startup/:cron...
***  INFO   | 2022-07-14 15:18:50 | Running /container/run/startup/:logrotate...
***  INFO   | 2022-07-14 15:18:50 | Running /container/run/startup/:ssl-tools...
***  INFO   | 2022-07-14 15:18:50 | Running /container/run/startup/:syslog-ng-core...
***  INFO   | 2022-07-14 15:18:50 | Running /container/run/startup/slapd...
***  INFO   | 2022-07-14 15:18:50 | openldap user and group adjustments
***  INFO   | 2022-07-14 15:18:50 | get current openldap uid/gid info inside container
***  INFO   | 2022-07-14 15:18:50 | CUR_USER_UID (911) does't match LDAP_OPENLDAP_UID (1012), adjusting...
***  INFO   | 2022-07-14 15:18:50 | CUR_USER_GID (911) does't match LDAP_OPENLDAP_GID (1000), adjusting...
***  INFO   | 2022-07-14 15:18:50 | -------------------------------------
***  INFO   | 2022-07-14 15:18:50 | openldap GID/UID
***  INFO   | 2022-07-14 15:18:50 | -------------------------------------
***  INFO   | 2022-07-14 15:18:50 | User uid: 1012
***  INFO   | 2022-07-14 15:18:50 | User gid: 1000
***  INFO   | 2022-07-14 15:18:50 | uid/gid changed: true
***  INFO   | 2022-07-14 15:18:50 | -------------------------------------
***  INFO   | 2022-07-14 15:18:50 | updating file uid/gid ownership
***  INFO   | 2022-07-14 15:18:51 | Start OpenLDAP...
***  ERROR  | 2022-07-14 15:18:51 | /container/run/startup/slapd failed with status 1

***  INFO   | 2022-07-14 15:18:51 | Killing all processes...
***  INFO   | 2022-07-14 15:18:55 | CONTAINER_LOG_LEVEL = 3 (info)
***  INFO   | 2022-07-14 15:18:55 | Search service in CONTAINER_SERVICE_DIR = /container/service :
***  INFO   | 2022-07-14 15:18:55 | link /container/service/:cron/startup.sh to /container/run/startup/:cron
*** WARNING | 2022-07-14 15:18:55 | failed to link /container/service/:cron/startup.sh to /container/run/startup/:cron: [Errno 17] File exists: '/container/service/:cron/startup.sh' -> '/container/run/startup/:cron'
***  INFO   | 2022-07-14 15:18:55 | link /container/service/:cron/process.sh to /container/run/process/:cron/run
*** WARNING | 2022-07-14 15:18:55 | directory /container/run/process/:cron already exists
*** WARNING | 2022-07-14 15:18:55 | failed to link /container/service/:cron/process.sh to /container/run/process/:cron/run : [Errno 17] File exists: '/container/service/:cron/process.sh' -> '/container/run/process/:cron/run'
***  INFO   | 2022-07-14 15:18:55 | link /container/service/:logrotate/startup.sh to /container/run/startup/:logrotate
*** WARNING | 2022-07-14 15:18:55 | failed to link /container/service/:logrotate/startup.sh to /container/run/startup/:logrotate: [Errno 17] File exists: '/container/service/:logrotate/startup.sh' -> '/container/run/startup/:logrotate'    
***  INFO   | 2022-07-14 15:18:55 | link /container/service/:ssl-tools/startup.sh to /container/run/startup/:ssl-tools
*** WARNING | 2022-07-14 15:18:55 | failed to link /container/service/:ssl-tools/startup.sh to /container/run/startup/:ssl-tools: [Errno 17] File exists: '/container/service/:ssl-tools/startup.sh' -> '/container/run/startup/:ssl-tools'    
***  INFO   | 2022-07-14 15:18:55 | link /container/service/:syslog-ng-core/startup.sh to /container/run/startup/:syslog-ng-core
*** WARNING | 2022-07-14 15:18:55 | failed to link /container/service/:syslog-ng-core/startup.sh to /container/run/startup/:syslog-ng-core: [Errno 17] File exists: '/container/service/:syslog-ng-core/startup.sh' -> '/container/run/startup/:syslog-ng-core'
***  INFO   | 2022-07-14 15:18:55 | link /container/service/:syslog-ng-core/process.sh to /container/run/process/:syslog-ng-core/run
*** WARNING | 2022-07-14 15:18:55 | directory /container/run/process/:syslog-ng-core already exists
*** WARNING | 2022-07-14 15:18:55 | failed to link /container/service/:syslog-ng-core/process.sh to /container/run/process/:syslog-ng-core/run : [Errno 17] File exists: '/container/service/:syslog-ng-core/process.sh' -> '/container/run/process/:syslog-ng-core/run'
***  INFO   | 2022-07-14 15:18:55 | link /container/service/slapd/startup.sh to /container/run/startup/slapd
*** WARNING | 2022-07-14 15:18:55 | failed to link /container/service/slapd/startup.sh to /container/run/startup/slapd: [Errno 17] File exists: '/container/service/slapd/startup.sh' -> '/container/run/startup/slapd'
***  INFO   | 2022-07-14 15:18:55 | link /container/service/slapd/process.sh to /container/run/process/slapd/run
*** WARNING | 2022-07-14 15:18:55 | directory /container/run/process/slapd already exists
*** WARNING | 2022-07-14 15:18:55 | failed to link /container/service/slapd/process.sh to /container/run/process/slapd/run : [Errno 17] File exists: '/container/service/slapd/process.sh' -> '/container/run/process/slapd/run'
***  INFO   | 2022-07-14 15:18:55 | link /container/service/slapd-backup/startup.sh to /container/run/startup/slapd-backup
*** WARNING | 2022-07-14 15:18:55 | failed to link /container/service/slapd-backup/startup.sh to /container/run/startup/slapd-backup: [Errno 17] File exists: '/container/service/slapd-backup/startup.sh' -> '/container/run/startup/slapd-backup'
***  INFO   | 2022-07-14 15:18:55 | Environment files will be proccessed in this order :
Caution: previously defined variables will not be overriden.
/container/environment/98-default/default.yaml
/container/environment/99-default/default.startup.yaml
/container/environment/99-default/default.yaml

To see how this files are processed and environment variables values,
run this container with '--loglevel debug'
***  INFO   | 2022-07-14 15:18:55 | Running /container/run/startup/:cron...
***  INFO   | 2022-07-14 15:18:55 | Running /container/run/startup/:logrotate...
***  INFO   | 2022-07-14 15:18:56 | Running /container/run/startup/:ssl-tools...
***  INFO   | 2022-07-14 15:18:56 | Running /container/run/startup/:syslog-ng-core...
***  INFO   | 2022-07-14 15:18:56 | Running /container/run/startup/slapd...
***  INFO   | 2022-07-14 15:18:56 | openldap user and group adjustments
***  INFO   | 2022-07-14 15:18:56 | get current openldap uid/gid info inside container
***  INFO   | 2022-07-14 15:18:56 | -------------------------------------
***  INFO   | 2022-07-14 15:18:56 | openldap GID/UID
***  INFO   | 2022-07-14 15:18:56 | -------------------------------------
***  INFO   | 2022-07-14 15:18:56 | User uid: 1012
***  INFO   | 2022-07-14 15:18:56 | User gid: 1000
***  INFO   | 2022-07-14 15:18:56 | uid/gid changed: false
***  INFO   | 2022-07-14 15:18:56 | -------------------------------------
***  INFO   | 2022-07-14 15:18:56 | updating file uid/gid ownership
***  INFO   | 2022-07-14 15:18:57 | Start OpenLDAP...
***  ERROR  | 2022-07-14 15:18:57 | /container/run/startup/slapd failed with status 1

***  INFO   | 2022-07-14 15:18:57 | Killing all processes...
upya4ko commented 1 year ago

Have same problem, host Debian 12.1

ldap exited with code 1
ldap            | ***  INFO   | 2023-08-02 06:16:01 | CONTAINER_LOG_LEVEL = 3 (info)
ldap            | *** WARNING | 2023-08-02 06:16:01 | Copy /container/service to /container/run/service ignored
ldap            | *** WARNING | 2023-08-02 06:16:01 | /container/run/service already exists
ldap            | ***  INFO   | 2023-08-02 06:16:01 | Search service in CONTAINER_SERVICE_DIR = /container/run/service :
ldap            | ***  INFO   | 2023-08-02 06:16:01 | link /container/run/service/:cron/startup.sh to /container/run/startup/:cron
ldap            | *** WARNING | 2023-08-02 06:16:01 | failed to link /container/run/service/:cron/startup.sh to /container/run/startup/:cron: [Errno 17] File exists: '/container/run/service/:cron/startup.sh' -> '/container/run/startup/:cron'
ldap            | ***  INFO   | 2023-08-02 06:16:01 | link /container/run/service/:cron/process.sh to /container/run/process/:cron/run
ldap            | *** WARNING | 2023-08-02 06:16:01 | directory /container/run/process/:cron already exists
ldap            | *** WARNING | 2023-08-02 06:16:01 | failed to link /container/run/service/:cron/process.sh to /container/run/process/:cron/run : [Errno 17] File exists: '/container/run/service/:cron/process.sh' -> '/container/run/process/:cron/run'

UPD: I think i know where be a problem, i have dead cert-bot container, so ssl certs be "expired" so now all work ok again

to get more info use

command: "--loglevel debug --copy-service"