-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDjango_container
51 lines (34 loc) · 972 Bytes
/
Django_container
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
1. check which process is useing port 6379
```bash
sudo lsof -i:6379
```
2. Stop service and prevent it from restarting
```bash
sudo systemctl stop redis
```
3. Docker run and build
i. first remove containers in docker
ii. make 6379 port useable
```bash
sudo docker-compose up --build
```
4. Execute code on a container named "backend"
```bash
sudo docker exec -it backend sh
```
need to know more about
1. Avoid Using sudo
Running Docker with sudo isn't ideal for security and convenience. Instead, add your user to the docker group so you don't need to use sudo:
bash
Copy code
sudo usermod -aG docker $USER
After running this command, log out and log back in to apply the changes. Then, you can simply run:
bash
Copy code
docker-compose up --build
4. Remove Unused Resources Before Building
Clean up unused Docker resources (e.g., old images, containers) before running the build:
bash
Copy code
docker system prune -f
docker-compose up --build