No description
Find a file
2024-12-06 22:20:17 +05:30
install-docker.sh Add install-docker.sh 2024-12-06 22:02:33 +05:30
LICENSE Initial commit 2024-12-06 22:01:36 +05:30
README.md Update README.md 2024-12-06 22:20:17 +05:30

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:
git clone https://git.hhf.technology/hhf/docker-install-ubuntu-2404.git
cd docker-install-ubuntu
  1. Make the script executable:
chmod +x install-docker.sh
  1. Run the script:
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:

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

Contributing

Feel free to submit issues and pull requests.

Contact

If you have any questions or suggestions, please open an issue in the repository.