89 lines
No EOL
2.2 KiB
Markdown
89 lines
No EOL
2.2 KiB
Markdown
# Docker Installation Script for Ubuntu 24.04
|
|
|
|
A bash script to automate the installation and configuration of Docker on Ubuntu 24.04 (Noble Numbat).
|
|
|
|
## Features
|
|
|
|
- Complete Docker installation (Docker Engine, Docker CLI, Docker Compose)
|
|
- Automatic removal of old Docker versions
|
|
- Creates a dedicated Docker user with appropriate permissions
|
|
- Configures Docker daemon with sensible defaults
|
|
- Includes error handling and installation checkpoints
|
|
- Verifies installation with hello-world container
|
|
- Sets up Docker to start on boot
|
|
|
|
## Prerequisites
|
|
|
|
- Ubuntu 24.04 (Noble Numbat)
|
|
- Root access or sudo privileges
|
|
- Internet connection
|
|
|
|
## Installation
|
|
|
|
1. Clone this repository:
|
|
```bash
|
|
git clone https://git.hhf.technology/hhf/docker-install-ubuntu-2404.git
|
|
cd docker-install-ubuntu
|
|
```
|
|
|
|
2. Make the script executable:
|
|
```bash
|
|
chmod +x install-docker.sh
|
|
```
|
|
|
|
3. Run the script:
|
|
```bash
|
|
sudo ./install-docker.sh
|
|
```
|
|
|
|
## What the Script Does
|
|
|
|
1. Removes any conflicting Docker packages
|
|
2. Installs necessary prerequisites
|
|
3. Sets up Docker repository and GPG key
|
|
4. Installs Docker Engine and related tools
|
|
5. Creates a dedicated Docker user
|
|
6. Configures Docker daemon
|
|
7. Verifies the installation
|
|
8. Enables Docker service on boot
|
|
|
|
## Post-Installation
|
|
|
|
After installation:
|
|
- A new user 'dockeruser' is created and added to the Docker group
|
|
- You may need to log out and back in for group changes to take effect
|
|
- Docker daemon is configured with log rotation and default network settings
|
|
|
|
## Verification
|
|
|
|
To verify the installation:
|
|
```bash
|
|
docker --version
|
|
docker compose version
|
|
docker run hello-world
|
|
```
|
|
|
|
## Configuration
|
|
|
|
The script creates a default daemon configuration at `/etc/docker/daemon.json` with:
|
|
- Log rotation (max 3 files of 100MB each)
|
|
- Default address pool configuration
|
|
- JSON file logging driver
|
|
|
|
## Troubleshooting
|
|
|
|
- Check the installation logs in `/var/log/docker_install/`
|
|
- Each step creates a checkpoint file to track progress
|
|
- The script can be safely re-run if installation fails
|
|
|
|
## License
|
|
|
|
[MIT License](LICENSE)
|
|
|
|
## Contributing
|
|
|
|
Feel free to submit issues and pull requests.
|
|
|
|
## Contact
|
|
|
|
If you have any questions or suggestions, please open an issue in the repository. |