-
-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker image based on Alpine Linux is 4x smaller #99
Comments
Thanks @RyanRamchandar |
@RyanRamchandar can you test it with azul Java? |
@legacycode what do you think about it? |
Do we need Azul Java for x86 platform? |
@RyanRamchandar I'm currently working on an alpine version. |
@cniweb Do you need all these packages?
Alpine's default user has |
@RyanRamchandar I have problems with groupadd: |
Turns out I used a modified #!/bin/sh -x
set -euo pipefail
IFS=$'\n\t'
# Add openhab user & handle possible device groups for different host systems
# Container base image puts dialout on group id 20, uucp on id 10
# GPIO Group for RPI access
NEW_USER_ID=${USER_ID:-9001}
echo "Starting with openhab user id: $NEW_USER_ID"
if ! id -u openhab >/dev/null 2>&1; then
echo "Create user openhab with id 9001"
adduser -u $NEW_USER_ID -D -g '' -h ${APPDIR} openhab
fi
# Initialize empty host volumes
if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then
# Copy userdata dir for version 2.0.0
echo "No userdata found... initializing."
cp -av "${APPDIR}/userdata.dist/." "${APPDIR}/userdata/"
fi
if [ -z "$(ls -A "${APPDIR}/conf")" ]; then
# Copy userdata dir for version 2.0.0
echo "No configuration found... initializing."
cp -av "${APPDIR}/conf.dist/." "${APPDIR}/conf/"
fi
# Set openhab folder permission
chown -R openhab:openhab ${APPDIR}
exec "$@" *I updated my original post. |
@RyanRamchandar Ahh, OK, Thanks |
I build new images: |
I tried Here is the repeating part of the
I believe the error is related to this: This is also happening on my containers from the original post. |
@kaikreuzer Can you possibly look here? Thanks, |
No, sorry, I don't have any deeper insights there myself. I'd suggest @RyanRamchandar to dig into Karaf himself. The SO link looks like a good starting point... |
This seems to hang with the pid file. Maybe this is not done right. |
@RyanRamchandar @bademux |
@cniweb You can, but I'd add a note with this known reboot issue. |
@RyanRamchandar How should this note be with this known reboot problem? |
@cniweb If you choose to deploy it, I'd add a note to the readme; something to the effect of:
|
@cniweb to fix the restart issue we need to delete the Modify # Deleting instance.properties to avoid karaf PID conflict on restart
# See: https://github.com/openhab/openhab-docker/issues/99
rm -f /openhab/runtime/instances/instance.properties
#!/bin/sh -x
set -euo pipefail
IFS=$'\n\t'
# Deleting instance.properties to avoid karaf PID conflict on restart
# See: https://github.com/openhab/openhab-docker/issues/99
rm -f /openhab/runtime/instances/instance.properties
# Add openhab user & handle possible device groups for different host systems
# Container base image puts dialout on group id 20, uucp on id 10
# GPIO Group for RPI access
NEW_USER_ID=${USER_ID:-9001}
echo "Starting with openhab user id: $NEW_USER_ID"
if ! id -u openhab >/dev/null 2>&1; then
echo "Create user openhab with id ${NEW_USER_ID}"
adduser -u $NEW_USER_ID -D -g '' -h ${APPDIR} openhab
fi
# Initialize empty host volumes
if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then
# Copy userdata dir for version 2.0.0
echo "No userdata found... initializing."
cp -av "${APPDIR}/userdata.dist/." "${APPDIR}/userdata/"
fi
if [ -z "$(ls -A "${APPDIR}/conf")" ]; then
# Copy userdata dir for version 2.0.0
echo "No configuration found... initializing."
cp -av "${APPDIR}/conf.dist/." "${APPDIR}/conf/"
fi
# Set openhab folder permission
chown -R openhab:openhab ${APPDIR}
exec "$@" |
* Update README to Version 2.1.0 * Add Version 2.1.0 and 2.2.0-snapshot * Update entrypoint.sh (#94) (#1) * Echo actual `NEW_USER_ID`, instead of hardcoded/default id=9001. * Remove Version 2.2.0-snapshot and add 2.1.0-snapshot * Fix sudo enabled environment for travis * RUN chmod +x on entrypoint.sh within Dockerfile to fix permission issue * Add version 2.2.0-snapshot * Add MAINTAINER section * Docker image based on Alpine Linux #99 * Add alpine as base image and new architecture * Add alpine as base image in TravisCI build * Fix CMD in Dockerfiles * Openhab GROUP_ID can now be set via variable at container creation time * Fix #104 * Add shadow package for alpine * Change entrypoint.sh * Fix entrypoint.sh for alpine and version 1.8.3 * Add generated entrypoint.sh * Update readme for new alpine docker images
@RyanRamchandar I open a new issue: #108 |
OK, can I close this issue? |
Yes. |
I was able to create a much smaller working image based on Alpine Linux compared to the current imaged based on
multiarch/debian-debootstrap
166MB vs 720MB:
Try the images
I have pre-built the images and pushed them to https://hub.docker.com/r/umbrela/openhab. You can try them by pulling one of these:
docker pull umbrela/openhab:2.1.0-release-amd64
docker pull umbrela/openhab:2.1.0-release-arm64
Dockerfile
multiarch/alpine:x86_64-v3.5
entrypoint.sh
Build
$ docker build . -t testing/openhab-alpine-3.5-aarch64
Run
These images have been successfully tested on arm64 and amd64 platforms.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: