VM username is sbos
VM password is aabc
- inception tutorial
- vbenneko's inception
- mivw's inception
- Don't use the Docker group, use sudo
- /usr/local/bin/ rather than /usr/bin/ because future distribution upgrades may modify or delete them without warning
- wp config command documentation for wp-config.php
-
Ctrl + P + Q
detaches from a container -
docker build -t nginx srcs/requirements/nginx/
to build the nginx container -
docker image ls
to list the images -
docker image prune
to remove images with REPOSITORY and TAG<none>
-
docker image rm nginx
to remove the image with REPOSITORYnginx
-
docker ps -a
to list running containers -
docker run -it --rm <image name>
to create and run a new container from an image, where the terminal attaches its stdin and a TTY is allocated, and the container is automatically removed when it exits -
docker start 7e
restarts an existing container7e
-
docker attach 7e
attaches to a running container7e
-
docker stop 7e
to stop the container7e
-
docker rm <CONTAINER ID>
to remove the container7e
-
(docker stop $(docker ps -qa); docker rm $(docker ps -qa); docker rmi -f $(docker images -qa); docker volume rm $(docker volume ls -q); docker network rm $(docker network ls -q)) 2>/dev/null
stop all containers, remove all containers, remove all images, remove all volumes, remove all networks -
docker builder prune
to clear the build cache -
docker exec -it wordpress bash
to run the commandbash
in the running containerwordpress
-
docker logs <CONTAINER ID>
to see why the container exited -
docker inspect <CONTAINER ID
to get detailed information about why Docker might have killed the process, like"OOMKilled": true"
if you exceed the container memory limits and Docker kills your app
docker build -t nginx srcs/requirements/nginx/
to build the nginx containerdocker run -it --rm nginx
to run the nginx container
-
docker build -t mariadb srcs/requirements/mariadb/
to build the mariadb container -
docker run -it --rm -e DB_USER="sbos" -e DB_PASSWORD="aabc" mariadb
to run the mariadb container -
mariadb -e "CREATE DATABASE IF NOT EXISTS FOO;"
creates a databaseFOO
-
mariadb --password=aabc;
to log in as the root -
/etc/init.d/mariadb start
ormariadbd &
to manually run mariadb in the background -
show databases;
to list all databases -
use wordpress;
tells MariaDB to use thewordpress
database as the default (current) database for subsequent statements -
show tables;
lists the tables, sequences and views in the currently used database -
show warnings;
right after a command that printed1 warning
in order to view the warning -
select * from wp_users;
to show all rows of the tablewp_users
-
docker build -t wordpress srcs/requirements/wordpress/
to build the wordpress container -
docker run -it --rm wordpress
to run the wordpress container -
PAGER=cat /usr/local/bin/wp-cli.phar --allow-root
to show wp-cli's help list -
PAGER=cat /usr/local/bin/wp-cli.phar --allow-root --path="/var/www/wordpress" --dbhost="mariadb" --dbname=wordpress --dbuser="sbos" --dbpass="aabc" config create
to generatewp-config.php
-
find -type s
to list all sockets
docker compose --project-directory srcs up --build -d --remove-orphans
to start up the containersdocker compose --project-directory srcs down
to shut down the containers
If you do this project, make the docker-compose first; it is virtually impossible to get mariadb/nginx/wordpress working individually in my experience!
- Add
sbos
to thesudo
group withusermod -a -G sudo sbos
, and restart the VM for the change to take effect - Install ssh and git with
sudo apt install openssh-server git
- Set the git username and email with
git config --global user.name "MyNameIsTrez"
andgit config --global user.email "welfje@gmail.com"
- Install Docker for Debian by copying these commands
- Allow the user
sbos
to run docker commands without sudo by runningsudo groupadd docker
if the docker group doesn't exist yet, andsudo gpasswd -a $USER docker
to add sbos to the docker group. You need to restart the VM forgroups
to reflect the change, and for docker to work withoutsudo
- Need
events
andhttp
directives innginx.conf
- Need
sudo apt install make