Homelab Troubleshooting

Tips on running a Linux server and docker.

User Tools

Site Tools


docker

This is an old revision of the document!


Docker Hints and Tips

Docker needs daily or at least weekly maintenance with the help of the following command:

docker system prune -f

You should probably put that one on a systemd timer just in case.

General maintenance

Prune Unused Images

docker image prune -a

Information gathering

Check docker Disk Usage

docker system df

List all containers

docker ps -a

Pretty print the container info

docker ps --format "table {{.Names}}\t{{.Status}}\t \
  {{.Networks}}\t{{.Ports}}\t{{.Size}}"

Follow a container's log

docker logs -f container_name

Information on a network

docker network inspect network_name  

Information on a container

docker container inspect container_name  

Networking

Check all Networks

docker network ls

Prune Unused Networks

docker network prune

Container handling

Enter a container

docker attach mybb_mybb_1 

Show container history

docker history mybb/mybb:latest 

Get container interactive shell

docker exec -it mybb_mybb_1 /bin/sh

Stopping containers with specific name

docker container stop $(docker container ls -q --filter name=myapp*)

Bash function / alias to get a list of Docker image tags:

dtags () {
    local image="${1}"

    wget -q https://registry.hub.docker.com/v1/repositories/"${image}"/tags -O - \
        | tr -d '[]" ' | tr '}' '\n' | awk -F: '{print $3}'
}
docker.1630096242.txt.gz · Last modified: 2021/08/27 23:30 by alexk7110