all three containers works with alpine and user are configured

This commit is contained in:
hugo gogo
2022-09-19 23:46:28 +02:00
parent 3be5af0e68
commit 334092253f
9 changed files with 129 additions and 80 deletions

View File

@@ -27,45 +27,9 @@
- ? `rm -rf /var/lib/apt/lists/*` ?
---
## nginx basics
- `sudo netstat -tulpn` to print network connections and see if nginx is running
- or : `ps -ax | grep nginx`
- `sudo nginx -s quit` to stop it
- `sudo docker system prune -af --volumes` -> `-a` also unused images, `-f` without prompt for confirmation
- remove stopped containers
- remove unused networks
- remove unused images
- remove build cache
- `sudo docker ps -q` all runnings containers
- `sudo 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 images` to list docker images
- `sudo docker image rm <number>`
- `sudo docker ps` to list docker processes
- `sudo docker ps rm <name>`
**execute a docker-compose file**
- `sudo docker-compose up`
- or `sudo docker-compose -f ./path up` to specify a path
---
## docker-compose :
- [docker compose volumes](https://docs.docker.com/compose/compose-file/#volumes)
#### docker :
- [docker starter guide](https://docs.docker.com/get-started/)
- [docker compose volumes](https://docs.docker.com/compose/compose-file/#volumes)
- [docker glossaire](https://docs.docker.com/glossary/)
- [Dockerfile syntaxe](https://docs.docker.com/engine/reference/builder/)
- [determine the parent image](https://forums.docker.com/t/determine-the-parent-image/48611)
@@ -84,6 +48,24 @@
- [depends_on](https://docs.docker.com/compose/compose-file/#depends_on)
- [compose and env var](https://docs.docker.com/compose/environment-variables/)
- [specify path to named volumes](https://docs.docker.com/compose/compose-file/#volumes-top-level-element)
- [pass secret to container](https://medium.com/@zdk/simple-and-secure-way-to-pass-secrets-and-credentials-into-docker-containers-c2f66175b0a4)
###### 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 images` to list docker images
- `sudo docker image rm <number>`
- `sudo docker ps` to list docker processes
- `sudo docker ps rm <name>`
###### execute a docker-compose file
- `sudo docker-compose up`
- or `sudo docker-compose -f ./path up` to specify a path
###### docker pid 1
- nginx by default will create some child process (a master and some workers), then it quits (doc ?)
@@ -148,6 +130,7 @@
- it seems that using "secrets" only improve security for a swarm, when you must share your secrets with others, but if not the case, .env is as much secure ?
- to use secret in docker-compose, we need to use swarm, but it doesn't allow to use build, or up, so everything is different then and I don't have time to understand it fully
---
#### nginx
- [nginx begginer guide](https://hub.docker.com/_/nginx/)
- [nginx all directives for conf file](https://nginx.org/en/docs/dirindex.html)
@@ -157,11 +140,25 @@
- [configuring nginx with php-fpm](https://www.nginx.com/resources/wiki/start/topics/examples/phpfcgi/#connecting-nginx-to-php-fpm)
- [configuring nginx with alpine](https://wiki.alpinelinux.org/wiki/Nginx)
###### nginx basics
- `sudo netstat -tulpn` to print network connections and see if nginx is running
- or : `ps -ax | grep nginx`
- `sudo nginx -s quit` to stop it
- `sudo docker system prune -af --volumes` -> `-a` also unused images, `-f` without prompt for confirmation
- remove stopped containers
- remove unused networks
- remove unused images
- remove build cache
- `sudo docker ps -q` all runnings containers
- `sudo docker stop $(sudo docker ps -q)` stop all runnings containers
---
#### openssl
- [openssl faq](https://www.openssl.org/docs/faq.html)
- [openssl req man](https://www.openssl.org/docs/man1.0.2/man1/openssl-req.html)
- [SO discussion about ssl self signed certificate and becoming a CA](https://stackoverflow.com/questions/10175812/how-to-generate-a-self-signed-ssl-certificate-using-openssl)
---
#### mariadb
- [mariadb tutorial](https://www.mariadbtutorial.com/)
- server vs client :
@@ -178,6 +175,14 @@
- [mysql commande line](https://mariadb.com/kb/en/mysql-command-line-client/)
- [use mysql in script](https://stackoverflow.com/questions/59608632/mariadb-create-database-and-execute-sql-script-without-character-from-the)
- [no need to use FLUSH PRIVILEGES after GRANT](https://stackoverflow.com/questions/36463966/mysql-when-is-flush-privileges-in-mysql-really-needed)
- [can't connect to local server through socket](]https://stackoverflow.com/questions/11990708/error-cant-connect-to-local-mysql-server-through-socket-var-run-mysqld-mysq#23485424)
```
Can't connect to local server through socket '/run/mysqld/mysqld.sock'
sudo / find -type s
/var/lib/mysql/mysql.sock
```
- [mysqld](https://dev.mysql.com/doc/refman/8.0/en/mysqld.html)
###### mariadb basic commands :
@@ -204,7 +209,7 @@
```
DROP DATABASE <name>;
```
---
#### wordpress
- [install wp](https://wordpress.org/support/article/how-to-install-wordpress/#detailed-instructions)
@@ -213,7 +218,9 @@
- tar -xzvf latest.tar.gz
- [php-fpm : Fastcgi Process Manager](https://en.wikipedia.org/wiki/FastCGI)
- [install wp-cli](https://make.wordpress.org/cli/handbook/guides/installing/)
- [install wp-cli](https://wp-cli.org/#installing)
- [alternatives install](https://make.wordpress.org/cli/handbook/guides/installing/)
- [exemple install with composer](https://github.com/aestetype/alpine-wp-cli/blob/master/Dockerfile)
- [cli commands](https://developer.wordpress.org/cli/commands/)
- [cli install wordpress](https://make.wordpress.org/cli/handbook/how-to-install/)