55 lines
2.0 KiB
Markdown
55 lines
2.0 KiB
Markdown
# install-docker.sh — Docker installer script
|
|
|
|
## Purpose
|
|
- Installs Docker Engine, CLI, containerd and Compose plugin across common Linux distributions (Ubuntu/Debian, CentOS/RHEL, Fedora, Alpine, Arch).
|
|
|
|
## Requirements
|
|
- A Linux system with one of the supported distributions.
|
|
- `sudo` privileges for the user running the script.
|
|
- Internet access to download packages from Docker repositories.
|
|
|
|
## Usage
|
|
1. Make the script executable (if not already):
|
|
|
|
```bash
|
|
chmod +x install-docker.sh
|
|
```
|
|
|
|
2. Run the script as your normal user (you will be prompted for sudo):
|
|
|
|
```bash
|
|
./install-docker.sh
|
|
```
|
|
|
|
The script detects your OS via `/etc/os-release` and runs the appropriate package commands.
|
|
|
|
## Post-install steps
|
|
- The script enables and starts the Docker service via `systemctl`.
|
|
- It also adds the current user to the `docker` group. You may need to log out and log back in (or run `newgrp docker`) to use Docker without `sudo`.
|
|
|
|
## Notes & Troubleshooting
|
|
- Unsupported OS: the script exits with an error if the distribution is not recognized.
|
|
- On systems without `systemd` (or where `systemctl` is unavailable), service start/enable will fail—start Docker manually as appropriate for your init system.
|
|
- If package repository GPG fetch or keyring operations fail, verify network access and that `curl`/`gnupg` are present.
|
|
- The script assumes typical package managers: `apt`, `yum`, `dnf`, `apk`, or `pacman`.
|
|
|
|
## Example
|
|
```bash
|
|
# Run installer (prompts for sudo)
|
|
./install-docker.sh
|
|
|
|
# Verify Docker
|
|
docker --version
|
|
sudo systemctl status docker
|
|
```
|
|
|
|
## Security
|
|
- The script adds official Docker package repositories and installs upstream packages. Review the commands if you have custom security requirements.
|
|
|
|
## Contributing / Changes
|
|
- To adapt the script for additional distributions or custom mirrors, add/modify the `case` branches that handle installation for each `OS`.
|
|
|
|
## License
|
|
- No license included. If you want this README or script under a specific license, add a LICENSE file.
|
|
|