User Tools

Site Tools


Docker commands

Run bash inside container

docker exec -it <container> /bin/bash

Copy file from host to container

docker cp <localfile> <container>:<container_path>

e.g. docker cp LocalSettings.php my-mediawiki:/var/www/html/

Get container IP

docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container-name>

Run kibana

Run kibana on http://localhost:5601 and connect to an elastic search instance running locally on port 9200, or tunneled from remote server:

docker run --name kib-01 -e ELASTICSEARCH_HOSTS=http://localhost:9200 --rm --network host

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

Remove only dangling volumes

Use this because of this bug

docker volume rm $(docker volume ls -q -f dangling=true)

Connect to different docker daemon running on different port

Example connecting to 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
wiki/docker_commands.txt · Last modified: 2023/09/26 11:52 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