docker info
docker system info
- sudo groupadd docker
- sudo usermod -aG docker $USER ( add current user into docker group )
- sudo service docker restart
- /etc/default/docker
export http_proxy="http://host:3128/"
- ~/.docker/config.json
{
"proxies":
{
"default":
{
"httpProxy": "http://127.0.0.1:3001",
"noProxy": "*.test.example.com,.example2.com"
}
}
}
- docker run --env-file environment.file {image name}
( or via -e variables )
HTTP_PROXY=http://webproxy.host:3128
http_proxy=http://webproxy.host:3128
HTTPS_PROXY=http://webproxy.host:3128
https_proxy=http://webproxy.host:3128
NO_PROXY="localhost,127.0.0.1,.host.de,.viola.local"
no_proxy="localhost,127.0.0.1,.host.de,.viola.local"
- /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://webproxy.host.de:3128/" "NO_PROXY=localhost,127.0.0.1,.host.de,.viola.local,.local"
docker search <text of search>
docker pull <image name>
image can be found: https://hub.docker.com/ example of command: docker pull mysql
docker images --all
-v /tmp:/home/root/tmp
docker volume ls
-p 8030-8033:8030-8033/tcp
-p 8040:8040/tcp
- --detach
- -d=true
- -d
docker run --name my_specific_name {name of image}
docker run --user root {name of image}
docker start {CONTAINER ID}
docker volume create {volume name}
docker volume inspect {volume name}
( "Mountpoint" will show real position )
docker volume ls
docker run {name of image} -v {volume name}:/folder/inside/container
docker run {name of image} -mount source={volume name},target=/folder/inside/container
docker ps
docker ps -a
docker attach {CONTAINER ID}
docker logs --follow --tail 25 {CONTAINER ID}
docker logs {CONTAINER ID}
docker top {CONTAINER ID}
docker exec -it {CONTAINER ID} /bin/bash
docker diff {CONTAINER ID}
docker history --no-trunc {CONTAINER ID}
docker inspect
docker inspect -f '{{.HostConfig.PortBindings}}' {CONTAINER ID}
docker commit {CONTAINER ID} <new image name>
docker tag {CONTAINER ID} <TAG NAME[:TAG VERSION]>
docker save --output <output file name>.tar {CONTAINER ID}
docker export --output <output file name>.tar {CONTAINER ID}
docker load -i {filename of archive}
docker import -i {filename of archive}
docker wait {CONTAINER ID}
docker stop {CONTAINER ID}
docker pause {CONTAINER ID}
docker unpause {CONTAINER ID}
docker kill {CONTAINER ID}
just kill the terminal
docker rm `docker ps -a | awk -F ' ' '{print $1}'`
docker rmi <IMAGE ID>
docker rmi --force <IMAGE ID>
docker volume ls -qf dangling=true | xargs -r docker volume rm
docker network ls
docker network ls | grep "bridge"
docker network rm $(docker network ls | grep "bridge" | awk '/ / { print $1 }')
docker system df
docker system prune
- create network
docker network create --subnet=172.18.0.0/16 docker.local.network
- assign address with network
docker run --net docker.local.network --ip 172.18.0.100 --hostname hadoop-local --network-alias hadoop-docker -it {CONTAINER ID} /bin/bash
- check network
docker inspect {CONTAINER ID} | grep -i NETWORK
--net=host
docker pull portainer/portainer
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer
login/pass: admin/12345678
docker build -t {name of my own image}:latest {name of docker file | . }
command | description |
---|---|
FROM | Sets the base image for subsequent |
MAINTAINER | Sets the author field of the generated images |
RUN | Execute commands in a new layer on top of the current image and commit the results |
CMD | Allowed only once (if many then last one takes effect) |
LABEL | Adds metadata to an image |
EXPOSE | Informs container runtime that the container listens on the specified network ports at runtime |
ENV | Sets an environment variable |
ADD | Copy new files, directories, or remote file URLs from into the filesystem of the container |
COPY | Copy new files or directories into the filesystem of the container |
ENTRYPOINT | Allows you to configure a container that will run as an executable |
VOLUME | Creates a mount point and marks it as holding externally mounted volumes from native host or other containers |
USER | Sets the username or UID to use when running the image |
WORKDIR | Sets the working directory for any RUN, CMD, ENTRYPOINT, COPY, ADD commands |
ARG | Defines a variable that users can pass at build-time to the builder using --build-arg |
ONBUILD | Adds an instruction to be executed later, when the image is used as the base for another build |
STOPSIGNAL | Sets the system call signal that will be sent to the container to exit |
- docker run --hostname=quickstart.cloudera --privileged=true -t -i -p 7180 4239cd2958c6 /usr/bin/docker-quickstart
- docker exec -it high_mclean /bin/bash
- docker run -v /tmp:/home/root/tmp --net docker.local.network --ip 172.18.0.100 --hostname hadoop-local --network-alias hadoop-docker -t -i -p 50075:50075/tcp -p 50090:50090/tcp sequenceiq/hadoop-docker /etc/bootstrap.sh -bash
- docker run --detach --env MYSQL_ROOT_PASSWORD=root --env MYSQL_USER=root --env MYSQL_PASSWORD=root --env MYSQL_DATABASE=technik_db --name golang_mysql --publish 3306:3306 mysql;
- MariaDB
docker run --name mysql-container --volume /my/local/folder/with/data:/var/lib/mysql --volume /my/local/folder/with/init/scripts:/docker-entrypoint-initdb.d --publish 3306:3306 --env MYSQL_DATABASE=activitidb --env MYSQL_ROOT_PASSWORD=root --detach mariadb --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
- MariaDB sql dump creation:
docker exec mysql-container sh -c 'exec mysqldump --all-databases -uroot -p"$MYSQL_ROOT_PASSWORD"' > /some/path/on/your/host/all-databases.sql