Skip to content

Instantly share code, notes, and snippets.

@arye321
Last active July 7, 2023 10:20
Show Gist options
  • Save arye321/d4bbbcab4505536e92406b8b226068b5 to your computer and use it in GitHub Desktop.
Save arye321/d4bbbcab4505536e92406b8b226068b5 to your computer and use it in GitHub Desktop.
docker
attach to console:
docker exec -it {img name} /bin/bash
or
docker exec -it {img name} /bin/sh
--network=host
docker run --name <name> -d -i -t ubuntu /bin/sh
docker run -i -t lazylion2/ubunto1:2 /bin/bash
docker images
docker run <image name>
docker attach <something name>
ctrl + P then ctrl + Q to exit without stopping // only works if running wiht -i -t
ctrl + d = exit = stopping
docker start <something name>
docker exec -dit bash
docker login
// username / proj name : version name
docker commit <containter id> lazylion2/ubunto:v1
docker images
docker push lazylion2/ubunto:v1
// filebrowser https://hub.docker.com/r/hurlenko/filebrowser
docker run -d --name filebrowser -p 80:8080 -v <host folder>:/data/<name of folder on browser> hurlenko/filebrowser
docker run -d --name filebrowser -p 8081:8080 -v /:/data/MyComputer hurlenko/filebrowser
//go into terminal
docker exec -t -i <image name or id> /bin/sh
//run Dockerfile
docker build -t getting-started .
# apt-get install bash-completion
Open a new shell. If completion is still not functioning you may need
to add (or uncomment) the following lines in
/etc/bash.bashrc. Alternatively these lines can be added
to any file that is sourced by your shell (i.e ~/bashrc, ~/bash_profile)
# enable bash completion in interactive shells
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
Debian package installed as above adds file
/etc/bash_completion.d/docker. If you do not have this
file you will need to download it and place it in
/etc/bash_completion directory. You can find this file
online using your favourite search engine and the search termsdocker completion gist

get ip address:

docker inspect -f '{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment