Skip to content

Conversation

@tkurki
Copy link
Member

@tkurki tkurki commented Jan 13, 2026

This is a temporary PR for testing Docker build for #2220

Rebased on master with a branch name that should trigger CI to build dev container, like from master.

@tkurki tkurki changed the title Build docker Testing: docker CI build for #2220 Jan 13, 2026
@tkurki tkurki closed this Jan 14, 2026
dirkwa and others added 13 commits January 14, 2026 11:04
Change Docker images to use local npm install instead of global (npm -g).
This avoids permission issues when installing plugins and running in
rootless container environments like Podman.

Changes:
- Dockerfile: use npm install instead of npm i -g for tarballs
- Dockerfile_rel: use npm install instead of npm i -g for release
- Dockerfile_base_24.04: remove setcap on node binary (not needed)
- startup.sh: update path to local node_modules/.bin/
- README.md: update documentation for new directory structure

The server now installs in /home/node/signalk/node_modules/ and runs
entirely in user space without requiring special capabilities.
When running with rootless Podman/Docker and the host's D-Bus socket
mounted, the container should use the host's D-Bus and Avahi services
instead of trying to start its own.

Previously, startup.sh always tried to start D-Bus and Avahi, which
produced confusing error messages like "Address already in use" and
"Failed to contact D-Bus daemon" even though everything worked fine.

Now we detect if the host D-Bus socket is already connected and skip
starting container services in that case. This gives clean startup
logs for rootless container deployments while maintaining backwards
compatibility with Docker Compose setups that don't mount the socket.
Symlinks don't work reliably in all Docker/Compose configurations.
Copy the @SignalK packages to the nested node_modules location
where the admin-ui expects to find them.
Allow Dockerfile_base_24.04 to accept NODE_VERSION build arg (e.g.,
NODE_VERSION=22) in addition to existing NODE arg (e.g., NODE=22.x)
for better compatibility with different build scenarios.

Add shell logic to ensure NodeSource setup script receives proper
version format (with .x suffix) regardless of input format.

Maintains backward compatibility with CI/CD workflows that use
--build-arg NODE=22.x while enabling manual builds with
--build-arg NODE_VERSION=22.
Add automatic detection of container runtime environment and export
CONTAINER_RUNTIME environment variable to differentiate between Docker,
Podman, Kubernetes, containerd, CRI-O, and LXC at runtime.

Detection uses multiple methods in priority order:
- File markers (/.dockerenv for Docker, /run/.containerenv for Podman)
- Environment variables (KUBERNETES_SERVICE_HOST for Kubernetes)
- cgroup patterns (/kubepods, /lxc, /containerd, /docker, /libpod)
- Runtime sockets (/var/run/crio, /var/run/containerd/containerd.sock)

This enables plugins and addons to adapt behavior based on the actual
runtime environment. The same container image now works across all
runtimes while exposing runtime-specific information via
process.env.CONTAINER_RUNTIME.

Maintains backward compatibility with IS_IN_DOCKER environment variable
which remains set to "true" in all containerized environments for
existing server update detection logic.

Users can override detection by setting CONTAINER_RUNTIME manually:
docker run -e CONTAINER_RUNTIME=custom signalk/signalk-server

Modified files:
- docker/startup.sh: Add runtime detection logic for 6 container runtimes
- docker/README.md: Add comprehensive documentation with usage examples
  and detection methods for all supported runtimes
Docker image build with minimal amount of build steps to minimize image size
Removes accidental trailing single quote from signalk-server start command
that was introduced in 6a5c57d.
- Move IS_IN_DOCKER from Dockerfile ENV to startup.sh for centralized
  container detection (alongside CONTAINER_RUNTIME)
- Simplify Container Runtime Detection section in README.md per
  maintainer feedback (remove verbose Detection Methods, Usage in Code,
  Manual Override, and Backward Compatibility sections)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants