Rootless DOCKER

From Pulsed Media Wiki
Revision as of 17:29, 17 April 2025 by Gallogeta (talk | contribs) (Created page with " == Rootless Docker (Basic) == You can manage Docker containers without needing '''sudo''' '''systemctl --user''': This command manages systemd user services. Rootless Docke...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Rootless Docker (Basic)

You can manage Docker containers without needing sudo

systemctl --user: This command manages systemd user services. Rootless Docker often uses systemd for managing its services within your user session.


Start:

systemctl --user start docker.socket

systemctl --user start docker.service

Verify Docker is Running: docker info

docker ps --Lists currently running Docker containers.

docker ps -a --Lists all Docker containers (running and stopped).

docker images --Lists downloaded Docker images.

docker pull image_name --Downloads a Docker image from a registry (like Docker Hub).

docker run image_name --Creates and starts a Docker container from an image. You'll often need to specify ports and volumes.

docker run -d --name my_container -p 8080:80 nginx --Runs an Nginx container in the background (-d), names it my_container, and maps port 8080 on the host to port 80 in the container.

docker stop container_id_or_name --Stops a running Docker container.

docker start container_id_or_name --Starts a stopped Docker container.

docker restart container_id_or_name --Restarts a Docker container.

docker rm container_id_or_name --Removes a stopped Docker container.

docker rmi image_name --Removes a Docker image. Use with caution!


Set Environment Variables (If Necessary) echo $DOCKER_HOST

If it's not set or you encounter issues, you might need to set it manually. Consult the rootless Docker documentation or the output of your installation.