Skip to content

Commit 8f33c29

Browse files
committed
Add extra help using docker in README
1 parent 4e21a9b commit 8f33c29

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,33 @@ git clone https://github.com/openaustralia/planningalerts.git
2424
cd planningalerts
2525
```
2626

27+
### Resetting Your Environment
28+
29+
To force a rebuild from scratch, stopping and removing containers and volumes (including the databases):
30+
31+
```sh
32+
docker compose down -v --rmi all
33+
# Check if this volume is "still in use"
34+
docker volume rm planningalerts_gem_cache
35+
```
36+
37+
If you get a `volume is in use` error, remove the container using the given id and then retry, for example:
38+
39+
```sh
40+
> Error response from daemon: remove planningalerts_gem_cache: volume is in use - [98ba717d944d01976ac9074e6a1119e70d3aebd53f5d5449957324926f0bbb4b]
41+
42+
docker rm 98ba717d944d01976ac9074e6a1119e70d3aebd53f5d5449957324926f0bbb4b
43+
> 98ba717d944d01976ac9074e6a1119e70d3aebd53f5d5449957324926f0bbb4b
44+
45+
docker volume rm planningalerts_gem_cache
46+
```
47+
2748
### Setup The Database
2849

2950
Set up the databases - `docker compose run web bin/rake db:setup`
3051

52+
This will trigger a build if needed. You can manually trigger a build by first running - `docker compose build`
53+
3154
### Start the application
3255

3356
* `docker compose up`
@@ -70,6 +93,16 @@ bin/tapioca dsl --environment=test
7093

7194
We use Shopify's [tapioca](https://github.com/Shopify/tapioca) gem to manage all our rbi files. We **don't** use `bundle exec srb rbi ...`.
7295

96+
### Other useful docker commands
97+
98+
* `docker compose ps` - View running containers and their status
99+
* `docker compose logs [-f] [service]` - View logs for all or a specific service, add `-f` to continue watching (the up command also does this)
100+
* `docker compose restart web` - Restart the web container (eg when you make a change to the code)
101+
* `docker compose down` - Stop and remove containers (keeps volumes and images intact for quick restart)
102+
* `docker compose exec web bash` - Run a shell in the running container
103+
* `docker compose run web bin/rails console` - Run a once-off command in new container
104+
* `docker system prune --all` - Remove all stopped containers, orphaned images / networks, build cache etc. (Remove the -v if you want to keep your databases and gem cache)
105+
73106
## Deployment
74107

75108
The code is deployed using Capistrano. To deploy to production run:

0 commit comments

Comments
 (0)