-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker.sh
More file actions
27 lines (20 loc) · 820 Bytes
/
docker.sh
File metadata and controls
27 lines (20 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# Script to install Docker on an EC2 instance and configure permissions
# Update the package list
sudo apt-get update -y
# Install Docker
sudo apt-get install docker.io -y
# Add the 'ubuntu' and 'jenkins' users to the 'docker' group to allow running Docker without sudo
sudo usermod -aG docker ubuntu
sudo usermod -aG docker jenkins
# Apply the new group settings immediately
newgrp docker
# Set correct permissions for the Docker socket to allow 'docker' group members to access it
sudo chmod 660 /var/run/docker.sock
sudo chown root:docker /var/run/docker.sock
# Restart Docker service to apply changes
sudo systemctl restart docker
# Verify installation
docker -version
# Run SonarQube container in detached mode with port mapping
#docker run -d --name sonar -p 9000:9000 sonarqube:lts-community