Automated Docker Environment Configuration for Linux
Detects your OS, installs the official Docker Engine, creates dedicated users with correct permissions,
and optionally deploys Portainer for immediate container management.
Features • Quick Start • Capabilities • VM-Setup • Notes
git clone https://github.com/Narehood/Docker-Prep
cd Docker-Prep
bash install.sh| Feature | Description |
|---|---|
| Auto-Detection | Identifies your distro and installs the correct Docker Engine package |
| User Management | Creates a dedicated Docker user or configures existing users for rootless access |
| Permission Fix | Automatically handles group assignments (usermod -aG docker) |
| Portainer Ready | Option to instantly deploy Portainer via the script |
| Checksum Gate | Verifies Scripts/*.sh against Scripts/.checksums.sha256 before execution |
| Secure Defaults | Ensures proper service enabling and user permission handling |
The script guides you through a simplified menu to perform the following:
| Action | Description |
|---|---|
| Install Docker Engine | Downloads the official installer to a temp file, then runs it (never curl | sh) |
| User Configuration | Creates a new user specifically for Docker or adds your current user |
| Security Groups | Adds the selected user to the docker group for non-root command execution |
| Portainer Deployment | Pulls and runs Portainer CE pinned to a verified image digest from the LTS release channel on port 9443 |
VM-Setup launches Docker-Prep from a pinned revision in a temporary checkout.
| Variable | Purpose |
|---|---|
DOCKER_PREP_EPHEMERAL=1 |
Marks the launch as temporary; disables self-update |
DOCKER_PREP_REVISION=<sha> |
Displays the pinned commit in the UI |
Example:
DOCKER_PREP_EPHEMERAL=1 DOCKER_PREP_REVISION=<full-sha> bash ./install.shVM-Setup syncs its pin when this repository publishes a GitHub Release.
- Bump
VERSIONininstall.sh(for example2.4.0). - Commit the change.
- Tag and push:
git tag v2.4.0 && git push origin v2.4.0 - The Release workflow creates the GitHub Release and, when
VM_SETUP_DISPATCH_TOKENis configured, notifies VM-Setup viarepository_dispatch(docker-prep-release).
Regenerate the trusted checksum manifest after changing any file under Scripts/:
bash tools/generate-checksums.shLocal validation (matches CI):
bash tests/security-checks.sh
shellcheck --severity=error install.sh Scripts/*.sh tests/*.sh tools/*.sh| Note | Details |
|---|---|
| Root Access | Script must be run as root or with sudo privileges |
| Re-Login Required | Log out and back in after adding a user to the Docker group |
| Portainer | If installed, accessible at https://<your-ip>:9443 |
| Ephemeral launches | When launched from VM-Setup, update the pin there instead of using menu self-update |
Licensed under the MIT License.
You are free to use and modify this script as you wish.