Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
work:docker [2021/12/08 22:16] magsilvawork:docker [2021/12/09 01:51] (current) magsilva
Line 2: Line 2:
  
 I use Fedora as baseline, thus all the instructions consider it :-) I use Fedora as baseline, thus all the instructions consider it :-)
 +
 +===== Installation =====
  
 Fedora provides Docker support using Podman or Docker CE. We will stick with Docker CE for now, as provided by package ''moby-engine'' (moby is the mascot of Docker): Fedora provides Docker support using Podman or Docker CE. We will stick with Docker CE for now, as provided by package ''moby-engine'' (moby is the mascot of Docker):
Line 17: Line 19:
   - ''dnf install docker-compose''   - ''dnf install docker-compose''
  
-If you want to run docker inside docker (nested docker instances), you may run the nested docker instance using the default Unix socket docker.sock as a volume. For example:+If you want to run docker inside docker (nested docker instances), you may run the nested docker instance using the default Unix socket docker.sock as a volume. The limitation in using ''docker.sock'' as a volume provided by the host is that any docker operations taking place on the nested docker instance actually runs on the base docker container rather than on the nested container (as the commands are routed to the docker.sock, which is actually provided the by host container. For example:
   - ''docker run -v /var/run/docker.sock:/var/run/docker.sock -ti docker''   - ''docker run -v /var/run/docker.sock:/var/run/docker.sock -ti docker''
  
-The limitation in using ''docker.sock'' as volume provided by the host is that any docker operations taking place on the nested docker instance actually runs on the base docker container rather than on the nested container (as the commands are routed to the docker.sock, which is actually provided the by host container.+An alternative to run nested docker instances is to use ''dind'' (Docker In Docker)You should use the docker image 'dindwith privileged host
 +  - ''docker run --privileged -d --name dind-test docker:dind'' 
 + 
 +==== Build new image ==== 
 +  - Create the file with the instructions to the new image to be build: ''Dockerfile'' 
 +  - Run ''docker build -t <image name>'' <directory with Dockerfile>'' 
 + 
 +==== Debugging running containers ==== 
 +  - Find the running container id. You may use the command ''docker ps'' to list the running ones. 
 +  - Enter into the running container: ''docker exec -it <container id> /bin/bash
  
 +==== References ====
 +  * https://devopscube.com/run-docker-in-docker/