docker-redis - final cleanup
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -109,7 +109,9 @@ To ensure the changes are fully applied, restart WSL2:
|
|||||||
2. Test Access from other Devices:
|
2. Test Access from other Devices:
|
||||||
- If you're running services inside WSL (e.g., a web server), ensure they are accessible from other devices on your local network using the static IP address you configured (e.g., `http://192.168.1.100:4000`).
|
- If you're running services inside WSL (e.g., a web server), ensure they are accessible from other devices on your local network using the static IP address you configured (e.g., `http://192.168.1.100:4000`).
|
||||||
|
|
||||||
## Step 6: Configuring `vm.overcommit_memory` in sysctl for WSL2
|
|
||||||
|
|
||||||
|
# Configuring `vm.overcommit_memory` in sysctl for WSL2
|
||||||
|
|
||||||
To prevent memory overcommitment issues and optimize performance, you can configure the `vm.overcommit_memory` setting in WSL2. This is particularly useful when running Redis or other memory-intensive services inside WSL2, as it helps control how the Linux kernel handles memory allocation.
|
To prevent memory overcommitment issues and optimize performance, you can configure the `vm.overcommit_memory` setting in WSL2. This is particularly useful when running Redis or other memory-intensive services inside WSL2, as it helps control how the Linux kernel handles memory allocation.
|
||||||
|
|
||||||
@@ -133,3 +135,48 @@ After editing the file, save it and then apply the new sysctl configuration by r
|
|||||||
sudo sysctl -p
|
sudo sysctl -p
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Install Docker and Docker Compose in WSL2
|
||||||
|
- https://docs.docker.com/desktop/wsl/
|
||||||
|
|
||||||
|
# Docker Commands
|
||||||
|
|
||||||
|
## General `docker-compose` Commands:
|
||||||
|
1. Bring up the services, force a rebuild of all services, and do not use the cache: `docker-compose up --build --no-cache`
|
||||||
|
2. Start Containers in Detached Mode: This will run the containers in the background (detached mode): `docker-compose up -d`
|
||||||
|
3. Stop and Remove Containers: Stops and removes the containers gracefully: `docker-compose down`
|
||||||
|
4. Stop containers without removing them: `docker-compose stop`
|
||||||
|
5. Remove Containers, Volumes, and Networks: `docker-compose down --volumes`
|
||||||
|
6. Force rebuild of containers: `docker-compose build --no-cache`
|
||||||
|
7. View running Containers: `docker-compose ps`
|
||||||
|
8. View a specific containers logs: `docker-compose logs <container-name>`
|
||||||
|
9. Scale services (multiple instances of a service): `docker-compose up --scale <container-name>=<instances number> -d`
|
||||||
|
|
||||||
|
## Volume Management Commands
|
||||||
|
1. List Docker volumes: `docker volume ls`
|
||||||
|
2. Remove Unused volumes `docker volume prune`
|
||||||
|
3. Remove specific volumes `docker volume rm <volume-name>`
|
||||||
|
4. Inspect a volume: `docker volume inspect <volume-name>`
|
||||||
|
|
||||||
|
## Container Image Management Commands:
|
||||||
|
1. List running containers: `docker ps`
|
||||||
|
2. List all containers: `docker os -a`
|
||||||
|
3. Remove Stopped containers: `docker container prune`
|
||||||
|
4. Remove a specific container: `docker container rm <container-name>`
|
||||||
|
5. Remove a specific image: `docker rmi <image-name>:<version>`
|
||||||
|
6. Remove all unused images: `docker image prune -a`
|
||||||
|
|
||||||
|
## Network Management Commands:
|
||||||
|
1. List networks: `docker network ls`
|
||||||
|
2. Inspect a specific network: `docker network inspect <network-name>`
|
||||||
|
3. Remove a specific network: `docker network rm <network-name>`
|
||||||
|
4. Remove unused networks: `docker network prune`
|
||||||
|
|
||||||
|
## Debugging and maintenance:
|
||||||
|
1. Enter a Running container: `docker exec -it <container name> /bin/bash` (could also be `/bin/sh` or for example `redis-cli` on a redis node)
|
||||||
|
2. View container resource usage: `docker stats`
|
||||||
|
3. Check Disk space used by Docker: `docker system df`
|
||||||
|
4. Remove all unused Data (Nuclear option): `docker system prune`
|
||||||
|
|
||||||
|
## Specific examples
|
||||||
|
1. To simulate a Clean state, one should run `docker system prune` followed by `docker volume prune -a`
|
||||||
|
2. You can run `docker-compose up` without the `-d` option, and you will get what is identical to the experience you were used to, this includes being able to control-c and bring the entire stack down
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- redis-cluster-net
|
- redis-cluster-net
|
||||||
volumes:
|
volumes:
|
||||||
- ./redis/dockerdata/redis-node-1:/data
|
- redis-node-1-data:/data
|
||||||
- ./redis/dockerdata/lock:/redis-lock
|
- redis-lock:/redis-lock
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "redis-cli", "ping"]
|
test: ["CMD", "redis-cli", "ping"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
@@ -32,8 +32,8 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- redis-cluster-net
|
- redis-cluster-net
|
||||||
volumes:
|
volumes:
|
||||||
- ./redis/dockerdata/redis-node-2:/data
|
- redis-node-2-data:/data
|
||||||
- ./redis/dockerdata/lock:/redis-lock
|
- redis-lock:/redis-lock
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "redis-cli", "ping"]
|
test: ["CMD", "redis-cli", "ping"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
@@ -49,8 +49,8 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- redis-cluster-net
|
- redis-cluster-net
|
||||||
volumes:
|
volumes:
|
||||||
- ./redis/dockerdata/redis-node-3:/data
|
- redis-node-3-data:/data
|
||||||
- ./redis/dockerdata/lock:/redis-lock
|
- redis-lock:/redis-lock
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "redis-cli", "ping"]
|
test: ["CMD", "redis-cli", "ping"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
@@ -96,7 +96,16 @@ services:
|
|||||||
- "3334:5540"
|
- "3334:5540"
|
||||||
networks:
|
networks:
|
||||||
- redis-cluster-net
|
- redis-cluster-net
|
||||||
|
volumes:
|
||||||
|
- redis-insight-data:/db
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
redis-cluster-net:
|
redis-cluster-net:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
redis-node-1-data:
|
||||||
|
redis-node-2-data:
|
||||||
|
redis-node-3-data:
|
||||||
|
redis-lock:
|
||||||
|
redis-insight-data:
|
||||||
|
|||||||
4
redis/dockerdata/.gitignore
vendored
4
redis/dockerdata/.gitignore
vendored
@@ -1,4 +0,0 @@
|
|||||||
*
|
|
||||||
!lock/
|
|
||||||
lock/*
|
|
||||||
!lock/.gitkeep
|
|
||||||
Reference in New Issue
Block a user