-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall-docker-rootless.zsh
More file actions
executable file
·51 lines (35 loc) · 1.72 KB
/
install-docker-rootless.zsh
File metadata and controls
executable file
·51 lines (35 loc) · 1.72 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/zsh
set -e
echo "📦 Installing Docker (rootless)..."
# Download and install Docker rootless
curl -fsSL https://get.docker.com/rootless | sh
echo "✅ Docker rootless installed."
# Run rootless setup, skip iptables check, continue on error
echo "⚙️ Running dockerd-rootless-setuptool.sh with --skip-iptables..."
~/bin/dockerd-rootless-setuptool.sh install --skip-iptables || echo "⚠️ Skipping setup tool errors."
# Set up environment variables
echo "⚙️ Setting up environment variables..."
echo 'export PATH=$HOME/bin:$PATH' >> ~/.zshrc
echo 'export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock' >> ~/.zshrc
export PATH=$HOME/bin:$PATH
export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock
echo "✅ Environment configured."
# Start the rootless Docker daemon in background
echo "🚀 Starting Docker daemon (rootless) in background..."
nohup dockerd-rootless.sh > ~/docker-rootless.log 2>&1 &
echo "✅ Docker daemon started in background (log: ~/docker-rootless.log)"
# Optional: install Docker Compose v2
echo "📦 Installing Docker Compose v2..."
mkdir -p ~/.docker/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.26.1/docker-compose-linux-x86_64 \
-o ~/.docker/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose
echo 'export PATH=$HOME/.docker/cli-plugins:$PATH' >> ~/.zshrc
export PATH=$HOME/.docker/cli-plugins:$PATH
echo "✅ Docker Compose installed."
# Verify installation
echo "🔍 Verifying installation..."
docker --version || echo "⚠️ Docker not found in PATH yet."
docker compose version || echo "⚠️ Docker Compose not found in PATH yet."
echo ""
echo "✅ All done! Run 'source ~/.zshrc' or restart your terminal to apply environment changes."