User Tools

Site Tools


linux:docker

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
linux:docker [2024/04/12 16:25] Wulf Rajeklinux:docker [2025/09/04 00:12] (current) – [GPU hardware acceleration] Wulf Rajek
Line 7: Line 7:
 apt-get -y install curl unzip dialog apt-get -y install curl unzip dialog
 curl -fSSL get.docker.com | sh curl -fSSL get.docker.com | sh
 +</code>
 +
 +Useful alias to exclude container overlays from the df command for use in .bashrc or .profile:
 +<code>
 +alias df='/usr/bin/df -x overlay'
 </code> </code>
  
Line 134: Line 139:
   devices:   devices:
    - /dev/dri:/dev/dri    - /dev/dri:/dev/dri
 +</code>
 +
 +for AMD:
 +https://rocm.docs.amd.com/projects/install-on-linux/en/latest/install/install-methods/package-manager/package-manager-debian.html
 +https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/docker.html
 +<code>
 +mkdir --parents --mode=0755 /etc/apt/keyrings
 +wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | gpg --dearmor | sudo tee /etc/apt/keyrings/rocm.gpg > /dev/null
 +echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/6.4.3 jammy main" > tee /etc/apt/sources.list.d/rocm.list
 +echo -e 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' > /etc/apt/preferences.d/rocm-pin-600
 +apt update
 +apt install rocm
 +</code>
 +Then add to the docker containers:
 +<code>
 +  devices:
 +    - /dev/kfd
 +    - /dev/dri
 +  security_opt:
 +    - seccomp=unconfined
 +  environment:
 +    - LIBVA_DRIVER_NAME=radeonsi
 +</code>
 +
 +Alpine Linux docker images may require libva to be installed:
 +<code>
 +    post_start:
 +      # for 13th gen Iris Xe GPUs use intel-media-driver for older gens libva-intel-driver
 +      # - command: apk add libva-intel-driver intel-media-driver
 +      #   user: root
 +      # For AMD
 +      - command: apk add libva libva-utils mesa-va-gallium
 +        user: root
 +</code>
 +
 +nvtop can be used for AMD and NVidia gpus to see if the gpu is being used.
 +On Debian, nvtop is in the contrib repositories which need to be added.
 +<code>
 +#bookworm
 +sed -r 's/^deb(.*)$/deb\1 contrib/g' /etc/apt/sources.list
 +
 +#new deb822 sources format
 +sed -i 's/^Components: main$/& contrib non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources
 +
 +apt update
 +</code>
 +On Ubuntu systems, nvtop is in the default repositories.
 +<code>
 +apt-get install nvtop
 +</code> 
 +===== docker ps short =====
 +Short form of docker ps to only get the container names:
 +<code>
 +docker ps | sed 's/   */#/g' | cut -d "#" -f 7
 +</code>
 +
 +
 +===== docker command template =====
 +https://stackoverflow.com/questions/50667371/docker-ps-output-formatting-list-only-names-of-running-containers
 +===== docker running out of network addresses =====
 +
 +Error response from daemon: all predefined address pools have been fully subnetted 
 +
 +<code json /etc/docker/daemon.json>
 +{
 +"default-address-pools":[
 +    {"base":"169.254.2.0/23","size":28},
 +    {"base":"169.254.4.0/22","size":28},
 +    {"base":"169.254.8.0/21","size":28},
 +    {"base":"169.254.16.0/20","size":28},
 +    {"base":"169.254.32.0/19","size":28},
 +    {"base":"169.254.64.0/18","size":28},
 +    {"base":"169.254.128.0/18","size":28},
 +    {"base":"169.254.192.0/19","size":28},
 +    {"base":"169.254.224.0/20","size":28},
 +    {"base":"169.254.240.0/21","size":28},
 +    {"base":"169.254.248.0/22","size":28}
 +  ]
 +}
 +</code>
 +<code>
 +docker restart
 +docker network prune
 </code> </code>
  
linux/docker.1712935514.txt.gz · Last modified: by Wulf Rajek