/
/
/
Ansible role that deploys my preferred docker setup that is accessible and writable by multiple users.
1# Docker Framework
2
3Creates the `/docker` base directory with proper ownership and permissions.
4
5## Key Parameters
6
7| Variable | Default | Description |
8|----------|---------|-------------|
9| `docker_framework_base_path` | `/docker` | Root directory for all Docker Compose services |
10| `docker_framework_owner` | `ansible` | Directory owner |
11| `docker_framework_group` | `users` | Directory group |
12| `docker_framework_mode` | `0775` | Directory permissions |
13| `docker_framework_sgid` | `true` | Set SGID bit so new files inherit group ownership |
14
15## Workflow
16
171. Create base directory at configured path
182. Set ownership and permissions
193. Apply SGID sticky bit (if enabled)
20
21## Troubleshooting
22
23### Docker containers not visible without sudo
24
25If `docker ps` shows nothing but `sudo docker ps` shows running containers, the user likely has a **rootless Docker daemon** running alongside the system daemon. Each daemon has its own containers and images.
26
27**Symptoms:**
28- `docker ps -a` shows no containers, `sudo docker ps -a` shows them
29- `docker context ls` shows a `rootless` context marked as active (`*`)
30- `docker compose up -d` pulls images fresh (even though they exist under the system daemon)
31
32**Fix:**
33```bash
34# Stop and disable the rootless docker daemon
35systemctl --user disable --now docker.service
36
37# Switch to the system docker context
38docker context use default
39
40# Remove the rootless context
41docker context rm rootless
42```
43
44After this, `docker ps` will talk to the system daemon where Ansible deploys containers.
45