This is a Bash script for installing Docker and Docker-compose on Ubuntu. The script is compatible with Ubuntu 18.04, 20.04, and 22.04, and supports optional installation of both Docker and Docker-compose.
Before running the script, make sure that you have a clean Ubuntu installation and that you have administrative privileges on the system.
To use the script, follow these steps:
- Download the script to your system.
- Make the script executable by running the following command in the directory where the script is located:
chmod +x docker-install.sh
- Run the script with the appropriate command line arguments to install Docker and/or Docker-compose, as described below.
The script supports the following command line arguments:
--with-docker
: Installs Docker.--with-compose
: Installs Docker-compose.
You can use these arguments to customize the installation according to your needs.
To install both Docker and Docker-compose, run the following command:
./docker-install.sh --with-docker --with-compose
This command installs Docker and adds the current user to the docker
group, enabling the user to run Docker commands without sudo. It also installs Docker-compose and verifies that both Docker and Docker-compose are installed correctly.
To install Docker-compose only, run the following command:
./docker-install.sh --with-compose
This command installs Docker-compose and verifies that it is installed correctly.
To install Docker only, run the following command:
./docker-install.sh --with-docker
This command installs Docker and adds the current user to the docker
group, enabling the user to run Docker commands without sudo. It also verifies that Docker is installed correctly.
After installing Docker and/or Docker-compose, you can verify that the installation was successful by running the following commands:
docker --version
: Prints the version of Docker installed on your system.docker-compose --version
: Prints the version of Docker-compose installed on your system (if installed).
This script is licensed under the MIT License. See the LICENSE
file for details.
This script is provided as-is and without any warranty. Use at your own risk. The author is not responsible for any damage or loss caused by the use of this script.