kerberos-io / kerberos-docker

Run Kerberos Open Source inside a docker container.
http://doc.kerberos.io/opensource/installation#docker
103 stars 31 forks source link

Docker container dies immediately on Raspberry Zero #23

Open KarlBaumann opened 4 years ago

KarlBaumann commented 4 years ago

pi@pi-zero-w:~ $ sudo docker start camera1 2020-02-09T20:53:58.340074224Z network connect 68c43e2bab7308ed42fbf78d10f81317e404e7e69454c3778077f8f168a1d63a (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, name=bridge, type=bridge) 2020-02-09T20:53:58.379730165Z volume mount 9c28d6d5b3bfe657ab416ab414ca585657bc8a6d2ecbf0dd252aa5c0f09cfa71 (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, destination=/etc/opt/kerberosio/capture, driver=local, propagation=, read/write=true) 2020-02-09T20:53:58.380225164Z volume mount a2665ad5fd450b87d43a12ac397c12d7d1c420773d4c0801fbfe998a31460c43 (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, destination=/etc/opt/kerberosio/config, driver=local, propagation=, read/write=true) 2020-02-09T20:53:58.380707163Z volume mount dab942a5b901f5024570eef77e7227f22c366ef0f396352209b9082993048124 (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, destination=/etc/opt/kerberosio/logs, driver=local, propagation=, read/write=true) 2020-02-09T20:53:58.381287162Z volume mount 9c0dd533d2afc565ec22f6f8ad08ef27d05103f4ebf0e8877f285b8897bc8306 (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, destination=/var/www/web/config, driver=local, propagation=, read/write=true) camera1 2020-02-09T20:54:03.377042665Z container start 0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3 (image=kerberos/kerberos, name=camera1) pi@pi-zero-w:~ $ 2020-02-09T20:54:04.389089139Z container die 0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3 (exitCode=139, image=kerberos/kerberos, name=camera1) 2020-02-09T20:54:05.106594056Z network disconnect 68c43e2bab7308ed42fbf78d10f81317e404e7e69454c3778077f8f168a1d63a (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, name=bridge, type=bridge) 2020-02-09T20:54:05.247325843Z volume unmount 9c28d6d5b3bfe657ab416ab414ca585657bc8a6d2ecbf0dd252aa5c0f09cfa71 (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, driver=local) 2020-02-09T20:54:05.253083835Z volume unmount a2665ad5fd450b87d43a12ac397c12d7d1c420773d4c0801fbfe998a31460c43 (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, driver=local) 2020-02-09T20:54:05.254248833Z volume unmount dab942a5b901f5024570eef77e7227f22c366ef0f396352209b9082993048124 (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, driver=local) 2020-02-09T20:54:05.260828823Z volume unmount 9c0dd533d2afc565ec22f6f8ad08ef27d05103f4ebf0e8877f285b8897bc8306 (container=0e3af8316239296ba8956e488086805d4978b418ce15096655368110942b54e3, driver=local)

cedricve commented 4 years ago

@KarlBaumann do you have any more debugging info?

KarlBaumann commented 4 years ago

Not really, I am new to Docker so I did not know how to debug it better. Afterwards I uninstalled docker and installed it the "Raspbian" way. This method kind a works, but very often kerberosio service is getting killed by OOM killer and I think this might have been the case with docker as well. Basically there is not enough RAM available. I can try to set up the docker environment again later if that helps.

cedricve commented 4 years ago

Not really, I am new to Docker so I did not know how to debug it better. Afterwards I uninstalled docker and installed it the "Raspbian" way. This method kind a works, but very often kerberosio service is getting killed by OOM killer and I think this might have been the case with docker as well. Basically there is not enough RAM available. I can try to set up the docker environment again later if that helps.

Thanks that would be of great help.

KarlBaumann commented 4 years ago

okay, after I set it up again, what would be the steps to get more debugging info?

cedricve commented 4 years ago

try to run the docker container and run docker logs.

KarlBaumann commented 4 years ago

Logs are compleately empty. I also do not see any messages in /var/log/messages about OOM killer, so it must be something else.

Could it be that that Docker image is simply not compatible with Pi Zero? Has anyone ever tested it?

cedricve commented 4 years ago

its an armv7 processor?

KarlBaumann commented 4 years ago

ARMv6: image

cedricve commented 4 years ago

interesting, which image did it download can you inspect the docker image kerberos/kerberos

KarlBaumann commented 4 years ago

https://pastebin.com/zEN21U6v

cedricve commented 4 years ago

Thanks what happens if you just do docker run -p 80:80 -p 8889:8889 kerberos/kerberos.

KarlBaumann commented 4 years ago

nothing image

cedricve commented 4 years ago

cann you try this image? (using the tag, kerberos/kerberos:linux-armv7)

https://hub.docker.com/layers/kerberos/kerberos/linux-armv7/images/sha256-03e597ffbe80f155230103fe6364521864127b1f42e95ed6fa731bf3d28fbdd9?context=explore

KarlBaumann commented 4 years ago

Compleately the same with that image

cedricve commented 4 years ago

will look into this @KarlBaumann

dbwest commented 3 years ago

Hi, I have a whole bunch of Raspberry Pi Zero Ws. And I am very psyched about getting kerberos.io working with them using Docker. uname -r on the units reveal they are ARMv6. I noticed there was no ARMv6 build in the Docker Hub registry. I also noticed that the instructions for cross compiling are on the readme.md. I tried a cross compile for ARMv6 and the build fails when grabbing PHP 7.1 packages from sury.org for debian stretch. I'll contact Sury about ARMv6 PHP packages, or changes to the Dockerfile might work. I have tried changing the PHP version, but that is all.

dbwest commented 3 years ago

FWIW... I opened this on Surý's bug tracker: https://github.com/oerdnj/deb.sury.org/issues/1455

cedricve commented 3 years ago

thanks @dbwest yes we still need to add support for ARMv6, thanks for helping ;)

dbwest commented 3 years ago

Wow, immediately heard back that there is no support and no intention to support armv6 from Surý. I am seeing if a Raspian base image is a thing because there is an ArmPort for Raspian that supports hard-float and targets armv6.

cedricve commented 3 years ago

Ok, maybe we might need to create an exception for this, and create an additional Dockerfile?

On 27 Aug 2020, at 15:45, David West notifications@github.com wrote:

Wow, immediately heard back that there is no support and no intention to support armv6 from Surý. I am seeing if a Raspian base image is a thing because there is an ArmPort for Raspian that supports hard-float and targets armv6.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/kerberos-io/kerberos-docker/issues/23#issuecomment-681958467, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALZUG35VWMIAF6RA5MPV2TSCZPP3ANCNFSM4KSENSZQ.

dbwest commented 3 years ago

That sounds good. I am doing some sort of hackery now where I changed the Dockerfile in my fork. Build is here and going now. It has at least gotten to the NASM bit with some changes to use Raspbian and get Node differently: https://github.com/dbwest/kerberos-docker/runs/1036980595?check_suite_focus=true

You are right about an additional Dockerfile, or something better organized than what I am trying now. Provided this builds and pushes to my Dockerhub, I'll test it on some hardware.

The rest is organization and preferences and I'll leave the direction up to you on how to organize and fold it in to the upstream if desired.

cedricve commented 3 years ago

That would be great @dbwest let me know if you need help or would get stuck. More then happy to help!

dbwest commented 3 years ago

So it looks like it built. I am going to try deploying it to the pi zero w I want to use with kerberos.io, and if it works I will tidy this up and do a pull request with a new Dockerfile and submit for review.

https://hub.docker.com/repository/docker/dbwest/kerberos-io

cedricve commented 3 years ago

WONDERFUL! share with me your findings ;)

On 27 Aug 2020, at 20:40, David West notifications@github.com wrote:

So it looks like it built. I am going to try deploying it to the pi zero w I want to use with kerberos.io, and if it works I will tidy this up and do a pull request with a new Dockerfile and submit for review.

https://hub.docker.com/repository/docker/dbwest/kerberos-io https://hub.docker.com/repository/docker/dbwest/kerberos-io — You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/kerberos-io/kerberos-docker/issues/23#issuecomment-682122636, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALZUG7UN4D3UKU3X4YP4ITSC2SBBANCNFSM4KSENSZQ.

dbwest commented 3 years ago

I deployed it and there are still problems. Attaching the log FWIW. I tried deploying to balena.io with this repo: https://github.com/dbwest/kerberos

Logs attached from the failing service... Capture kerberos-balena-dbw_young-frog-27.08.20_17_2716(-0400).txt

I'll hook up the Pi Zero W soon, after I finish some other things I have to do, and get some debugging in with the image I uploaded to Docker hub, maybe by supressing the entrypoint and going into the container without it and trying to start things up inside and poke around.

cedricve commented 3 years ago

Thanks for sharing ;) Can you show contents of run.sh

    27.08.20 16:22:13 (-0400) <main> /run.sh: line 49:    13 Done     
dbwest commented 3 years ago
#!/bin/bash

autoremoval() {
  while true; do
    sleep 60
    if [[ $(df -h /etc/opt/kerberosio/capture | tail -1 | awk -F' ' '{ print $5/1 }' | tr ['%'] ["0"]) -gt 90 ]];
    then
      echo "Cleaning disk"
      find /etc/opt/kerberosio/capture/ -type f | sort | head -n 100 | xargs rm;
    fi;
  done
}

copyConfigFiles() {
  # Check if the config dir is empty, this can happen due to mapping
  # an empty filesystem to the volume.
  TEMPLATE_DIR=/etc/opt/kerberosio/template
  CONFIG_DIR=/etc/opt/kerberosio/config
  if [ "$(ls -A $CONFIG_DIR)" ]; then
      echo "Config files are available."
  else
      echo "Config files are missing, copying from template."
      cp /etc/opt/kerberosio/template/* /etc/opt/kerberosio/config/
      chmod -R 777 /etc/opt/kerberosio/config
  fi

  # Do the same for the web config
  TEMPLATE_DIR=/var/www/web/template
  CONFIG_DIR=/var/www/web/config
  if [ "$(ls -A $CONFIG_DIR)" ]; then
      echo "Config files are available."
  else
      echo "Config files are missing, copying from template."
      cp /var/www/web/template/* /var/www/web/config/
      chmod -R 777 /var/www/web/config
  fi
}

# replace SESSION_COOKIE_NAME
random=$((1+RANDOM%10000))
sed -i -e "s/kerberosio_session/kerberosio_session_$random/" /var/www/web/.env

autoremoval &
copyConfigFiles &

# changes for php 7.1
echo "[www]" > /etc/php/7.1/fpm/pool.d/env.conf
echo "" >> /etc/php/7.1/fpm/pool.d/env.conf
env | grep "KERBEROSIO_" | sed "s/\(.*\)=\(.*\)/env[\1]='\2'/" >> /etc/php/7.1/fpm/pool.d/env.conf
service php7.1-fpm start

/usr/bin/supervisord -n -c /etc/supervisord.conf

I poked around more in that container, and although cat works, ls and sed and other common utilities give segfaults. Think if I redo that container and add back in some common utilities then it will work...

cedricve commented 3 years ago

@dbwest thanks, let us know if you have any break through ;)

cedricve commented 3 years ago

@dbwest not sure if already changed something? I have some time to elaborate on this issue.

kubo6472 commented 2 years ago

How is this handled on KiOS, that works with RPi Zero W no problem?