97e92321f194bd4519e88d45b5a1d4187e7ca876
inception
git next commit
- in makefile added -d to up in detach
- in makefile added close-nginx
- in makefile changed clean doesnt rm-images
questions
- ? what means mounted in "a file or directory on the host machine is mounted into a container" ?
- ? why the volumes cannot be modify outside docker ?
- ?
rm -rf /var/lib/apt/lists/*?
nginx basics
sudo netstat -tulpnto print network connections and see if nginx is running- or :
ps -ax | grep nginx sudo nginx -s quitto stop itsudo docker system prune -af --volumes->-aalso unused images,-fwithout prompt for confirmation- remove stopped containers
- remove unused networks
- remove unused images
- remove build cache
sudo docker ps -qall runnings containerssudo docker stop $(sudo docker ps -q)stop all runnings containers
Docker basics
- the container posess its own filesystem
- we need to copy the files it uses inside this filesystem
- we can do that with COPY
build and run a docker image
sudo docker build --tag <name> .sudo docker run <name>sudo docker imagesto list docker imagessudo docker image rm <number>sudo docker psto list docker processessudo docker ps rm <name>
execute a docker-compose file
sudo docker-compose up- or
sudo docker-compose -f ./path upto specify a path
ressources
docker :
-
docker exec -ti <container-name> bashto run bash inside a running container -
docker pid 1
- nginx by default will create some child process (a master and some workers), then it quits (doc ?)
- when the first process of a docker container exit, the container exit (doc ?)
- so we must tell nginx to not go background : "-g 'daemon off'"
- pid1 docker problem
- official nginx docker image
- "If you add a custom CMD in the Dockerfile, be sure to include -g daemon off; in the CMD in order for nginx to stay in the foreground, so that Docker can track the process properly (otherwise your container will stop immediately after starting)!"
- SO discussion on "-g 'daemon off'"
- "When PID 1 exits, the container will exit" (where is says in the doc ?)
- "By design, containers started in detached mode exit when the root process used to run the container exits"
install and use docker and compose
-
the version installed with apt is 1.17.1, way out of date
remove old versions
sudo apt remove docker docker-engine docker.io containerd runc
preparing directory
sudo apt updatesudo apt install ca-certificates curl gnupg lsb-releasesudo mkdir -p /etc/apt/keyringscurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpgecho "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
installing docker engine
sudo apt updatesudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
check if installation worked
sudo docker run hello-world
installing docker compose (checked version on github release, see above)
- notice the 'v' below, before the version name (docker doc has it wong)
sudo curl -L "https://github.com/docker/compose/releases/download/v2.10.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-composesudo chmod +x /usr/local/bin/docker-compose
volumes vs bind mounts :
- docker doc: use volumes
- docker doc: use bind mounts
- comparison volume vs bind mounts
- fundamentals use of volumes and bind mounts
- how volumes and bind mounts are really differents
- bind mounts are normal files anywhere on the computer, that docker container can access with absolut path and modify. They can also be modified without docker, since they are juste files
- volumes are only modifiable by docker, they don't need an absolut path, and they are not dependent of host architecture
nginx
- nginx begginer guide
- nginx all directives for conf file
- conf file in conf.d or sites-available ?
- command line parameters
sudo nginx -twill launch a test to evaluate config file
openssl
wordpress
-
install wp
- wget https://wordpress.org/latest.tar.gz
- tar -xzvf latest.tar.gz
mariadb
- mariadb tutorial
- server vs client :
- "server" runs in the background and listen for inputs
- "client" interpret the commands to communicate with "server"
- sudo apt install mariadb-client mariadb-server
- ERROR 1698 (28000): Access denied for user 'root'@'localhost'
- wiki ubuntu mariadb
php-fpm
Description
Languages
Dockerfile
62.6%
Makefile
20.3%
Shell
15.4%
Assembly
1.6%
HTML
0.1%