📝 Added notation regarding basics of docker

This commit is contained in:
z3rOR0ne 2022-06-29 02:55:30 -07:00
parent 6d3ee91383
commit 4571cabb15
3 changed files with 84 additions and 0 deletions

View file

@ -213,6 +213,10 @@ alias {cbpunk,cyberpunk}="steam steam://rungameid/1091500 &"
alias {twd,thewalkingdead}="steam steam://rungameid/1449690 &"
alias {cbmods,cybermods}="cd ~/.local/share/Steam/steamapps/common/Cyberpunk\ 2077/archive/pc/mod"
# docker specific Aliases
alias docker="doas docker"
alias docker-ls="doas docker container ls -a"
# bookmarks
alias codeberg="librewolf https://codeberg.org/ &"
alias sqlsc="links https://sqlservercentral.com"

54
docker_basics.txt Normal file
View file

@ -0,0 +1,54 @@
To search for an image to download:
doas docker search imagename
To install such image:
doas docker pull image
To view your images:
doas docker images
To view your containers:
doas docker containers ls -a
To show running containers, you can also input:
doas docker ps
Creating containers usually has specific commands, but always starts with docker run:
Example (installing mariadb):
docker run --name maraidbtest -e MYSQL_ROOT_PASSWORD=mypass -p 3306:3306 -d docker.io/library/mariadb
Starting/Stopping/Restarting containers
doas docker start imagename
doas docker stop imagename
doas docker restart imagename
Pausing/unpausing containers
docker pause containerid
docker unpause contaienrid
Checking container logs:
docker logs imagename
Accessing the container (dependent on type of container):
doas docker attach containerid
doas exec -it mariadbtest bash
Removing images/containers (stop image first):
doas docker rmi imagename
doas docker container rm containerid
SIDE NOTE ON MARIADB: Mariadb container is just a debian container, and can be updated using apt, etc.
https://mariadb.com/kb/en/installing-and-using-mariadb-via-docker/

26
docker_nginx_basics.txt Normal file
View file

@ -0,0 +1,26 @@
https://www.howtogeek.com/devops/what-does-docker-do-and-when-should-you-use-it/
mkdir ~/dockertest && cd ~/dockertest
echo -e "FROM nginx/nCOPY html /usr/share/nginx/html"
mkdir html && touch html/index.html
In index.html, write:
<!DOCTYPE html>
<html>
<body>
Hello From nginx, inside Docker! Inside, your computer?
</body>
</html>
In dockertest directory:
docker build -t dockertest .
And finally:
docker run --name DockerTest -p 8080:80 -d dockertest
In a browser, go to localhost:8080, and you should see your index.html file rendered.