User Tools

Site Tools


wiki:docker_commands

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
wiki:docker_commands [2022/06/03 12:31] – [Run kibana] add another run command, remove ports binding from first command antisawiki:docker_commands [2024/01/08 14:53] (current) – [Remove images older than 2 weeks] antisa
Line 24: Line 24:
 Run another instance simultaneously on 5602 port Run another instance simultaneously on 5602 port
   docker run --name kib-02 -e ELASTICSEARCH_HOSTS=http://localhost:9201 -e SERVER_PORT=5602 --rm --network host docker.elastic.co/kibana/kibana:7.10.0   docker run --name kib-02 -e ELASTICSEARCH_HOSTS=http://localhost:9201 -e SERVER_PORT=5602 --rm --network host docker.elastic.co/kibana/kibana:7.10.0
 +
 +===== Remove only dangling volumes =====
 +
 +Use this because of [[https://github.com/docker/cli/issues/4028|this bug]]
 +  docker volume rm $(docker volume ls -q -f dangling=true)
 +
 +===== Connect to different docker daemon running on different port =====
 +Example connecting to [[wiki:dockerized_jenkins_install_docker_via_ansible_dind|Dockerized jenkins install with docker in docker via ansible (dind)]] listening on 2376 port on host
 +  docker -H tcp://localhost:2376 version
 +
 +You will get error //Error response from daemon: Client sent an HTTP request to an HTTPS server//. You have to point the docker client to use the certificates e.g.
 +
 +  docker --tlsverify --tlscacert=/var/lib/docker/volumes/build-server_jenkins-docker-certs/_data/ca.pem --tlscert=/var/lib/docker/volumes/build-server_jenkins-docker-certs/_data/cert.pem --tlskey=/var/lib/docker/volumes/build-server_jenkins-docker-certs/_data/key.pem -H tcp://localhost:2376 ps
 +
 +===== How to determine what containers use the docker volume? =====
 +  docker ps -a --filter volume=VOLUME_NAME_OR_MOUNT_POINT
 +
 +===== Remove images older than 2 weeks =====
 +
 +  docker image prune -a --filter "until=336h" && docker system prune --filter "until=336h"
 +
 +The second command removes dangling build cache which will reclaim the disk space after image deletion.
wiki/docker_commands.1654252269.txt.gz · Last modified: 2022/06/03 12:31 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki