cleaned up readme and documentation

This commit is contained in:
2024-07-21 18:35:02 -07:00
parent 2bd83096a8
commit 68cee73585
6 changed files with 118 additions and 39 deletions
-2
View File
@@ -1,2 +0,0 @@
# Try and prevent passwords:
.env
+21 -10
View File
@@ -1,25 +1,30 @@
# Nick Yeoman's Collection of Docker compose files
<div align="center">
<img src="_assets/heading.svg" alt="Description of SVG" width="800"/>
</div>
Author: [Nick Yeoman](https://www.nickyeoman.com/).
👤 Author: [Nick Yeoman](https://www.nickyeoman.com/).
These cookbooks are created with the intent of using Docker's extend feature. This way, you can run multiple containers in different domains but still have only one file to update.
## 🤔 Assumptions
These compose files make a few assumptions:
1. You are only running on one host.
2. You are using Nginx Proxy Manager (although most have redundant port access).
3. Volumes are stored in the project folder under "data", git ignored and backed up externally.
## 📚 Workflow
The intended workflow is as follows:
1. Clone the repository locally ```git clone git@github.com:nickyeoman/docker-compose-cookbooks.git /git-repos/docker-compose-cookbooks```
2. Create a project directory, usually by domain ```mkdir /projects/domainname-com```
3. Create a .env file in the project directory ```touch .env```
4. Add the COOKBOOK Variable to the project's env file: ```COOKBOOK=/git-repos/docker-compose-cookbooks```
5. Create a .gitignore file in the project directory and ignore "data/"
6. Create a docker-compose.yml file in the project directory with the external code given in the README file in the container folder.
1. Clone the cookbook repository locally ```git clone git@github.com:nickyeoman/docker-compose-cookbooks.git /git-repos/docker-compose-cookbooks```
2. Change to the directory ```cd /git-repos/docker-compose-cookbooks```
3. Run the helper cli wizard: ```bash helper.bash```
4. Commit the new project to git.
## Example
You will likely want to override a number of things in the project folder, such as networks.
## 🔍 Example Result
Here is an example of how your project's docker-compose file might look:
@@ -39,4 +44,10 @@ services:
- .env
networks:
- proxy
```
```
with the .env file:
```text
COOKBOOK=/git-repos/docker-compose-cookbooks
```
+52
View File
@@ -0,0 +1,52 @@
<svg width="800" height="200" viewBox="0 0 800 200" xmlns="http://www.w3.org/2000/svg">
<!-- Background -->
<rect width="100%" height="100%" fill="#0d1117" />
<!-- Title Text -->
<text x="50%" y="50%" font-size="36" text-anchor="middle" fill="#fff" dy=".3em">Docker Compose Cookbooks</text>
<!-- Snowflakes -->
<g fill="#fff" opacity="0.7">
<circle class="snowflake" cx="50" cy="0" r="3" />
<circle class="snowflake" cx="150" cy="0" r="4" />
<circle class="snowflake" cx="250" cy="0" r="3" />
<circle class="snowflake" cx="350" cy="0" r="4" />
<circle class="snowflake" cx="450" cy="0" r="3" />
<circle class="snowflake" cx="550" cy="0" r="4" />
<circle class="snowflake" cx="650" cy="0" r="3" />
<circle class="snowflake" cx="750" cy="0" r="4" />
</g>
<!-- Snowflake Animation -->
<style>
@keyframes fall {
0% { transform: translateY(-200px); }
100% { transform: translateY(200px); }
}
.snowflake {
animation: fall 5s linear infinite;
}
.snowflake:nth-child(2) {
animation-duration: 6s;
}
.snowflake:nth-child(3) {
animation-duration: 7s;
}
.snowflake:nth-child(4) {
animation-duration: 8s;
}
.snowflake:nth-child(5) {
animation-duration: 9s;
}
.snowflake:nth-child(6) {
animation-duration: 10s;
}
.snowflake:nth-child(7) {
animation-duration: 11s;
}
.snowflake:nth-child(8) {
animation-duration: 12s;
}
</style>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

+43
View File
@@ -0,0 +1,43 @@
# Docker Cheatsheet
Reference: [Docker clean up guilde](https://gist.github.com/bastman/5b57ddb3c11942094f8d0a97d461b430)
## Stop all containers
Stops all running Docker containers by fetching the IDs of all containers and passing them to the `docker stop` command.
```bash
docker stop $(docker ps -aq)
```
## Docker Prune
Cleans up unused Docker objects, including stopped containers, unused networks, dangling images, and build cache. This helps in reclaiming disk space by removing objects not referenced by any containers.
```bash
docker system prune
```
## Remove unused images
Deletes all Docker images that are not currently used by any containers. This command helps in freeing up space taken by old or unused images.
```bash
docker rmi $(docker images -q)
```
## Delete unused volumes
Removes Docker volumes that are not currently used by any container. This helps in clearing up space used by data volumes that are no longer needed.
```bash
docker volume rm $(docker volume ls -qf dangling=true)
docker volume ls -qf dangling=true | xargs -r docker volume rm
```
## Remove used networks
Cleans up unused Docker networks. The docker network prune command removes all unused networks, while the docker network rm command can be used to remove specific networks, such as the default "bridge" network if not needed.
```bash
docker network prune
docker network rm $(docker network ls | grep "bridge" | awk '/ / { print $1 }')
```
-26
View File
@@ -1,26 +0,0 @@
#!/bin/bash
# Docker clean up guilde https://gist.github.com/bastman/5b57ddb3c11942094f8d0a97d461b430
# kill all containers
echo "*** Killing All Containers ***"
docker stop $(docker ps -aq)
echo "*** Docker prune ***"
docker system prune
#remove all images
echo "*** Removing all Docker images ***"
docker rmi $(docker images -q)
#delete all volumnes
echo "*** Removing all Docker volumes ***"
docker volume rm $(docker volume ls -qf dangling=true)
docker volume ls -qf dangling=true | xargs -r docker volume rm
#remove all networks
echo "*** Removing all Docker Networks ***"
docker network prune
docker network rm $(docker network ls | grep "bridge" | awk '/ / { print $1 }')
echo "*** All done ***"
+2 -1
View File
@@ -21,6 +21,7 @@ git clone git@github.com:nickyeoman/docker-compose-cookbooks.git
Note this setup is meant to be used between two directories, COOKBOOK and PROJECT.
In your PROJECT directory set the following env file:
#### Dot env file
```text
# Stash App
PROD=prod.domain.com
@@ -38,7 +39,7 @@ STASH_METADATA=/metadata/
STASH_CACHE=/cache/
```
### Docker Compose Extend
#### Docker Compose Extend
Now using extend you can call the service: