Skip to content

Commit 4869eab

Browse files
committed
Update readme for docker-compose v2
1 parent d8ea483 commit 4869eab

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

README.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ mkdir -p ignored/cratesfyi-prefix/crates.io-index
7070
# Builds the docs.rs binary
7171
SQLX_OFFLINE=1 cargo build
7272
# Start the external services.
73-
# It may be `docker compose` in newer versions
74-
docker-compose up -d db s3
73+
docker compose up -d db s3
7574
# anything that doesn't run via docker-compose needs the settings defined in
7675
# .env. Either via `. ./.env` as below, or via any dotenv shell integration.
7776
. ./.env
@@ -117,19 +116,26 @@ can take a look at its [documentation](https://github.com/GuillaumeGomez/browser
117116

118117
### Pure docker-compose
119118

120-
If you have trouble with the above commands, consider using `docker-compose up --build`,
119+
If you have trouble with the above commands, consider using `docker compose up --build`,
121120
which uses docker-compose for the web server as well.
122121
This will not cache dependencies - in particular, you'll have to rebuild all 400 whenever the lockfile changes -
123122
but makes sure that you're in a known environment so you should have fewer problems getting started.
124123

125124
You can also use the `web` container to run builds on systems which don't support running builds directly (mostly on Mac OS or Windows):
126125
```sh
127126
# run a build for a single crate
128-
docker-compose run web build crate regex 1.3.1
127+
docker compose run web build crate regex 1.3.1
129128
# or build essential files
130-
docker-compose run web build add-essential-files
129+
docker compose run web build add-essential-files
131130
# rebuild the web container when you changed code.
132-
docker-compose build web
131+
docker compose up -d web --build
132+
```
133+
134+
You can also run other commands like the setup above from within the container:
135+
136+
```sh
137+
docker compose run --rm cli database migrate
138+
docker compose run --rm cli build update-toolchain
133139
```
134140

135141
Note that running tests is not supported when using pure docker-compose.
@@ -151,14 +157,14 @@ Three services are defined:
151157

152158
#### Rebuilding Containers
153159

154-
To rebuild the site, run `docker-compose build`.
160+
To rebuild the site, run `docker compose build`.
155161
Note that docker-compose caches the build even if you change the source code,
156162
so this will be necessary anytime you make changes.
157163

158164
If you want to completely clean up the database, don't forget to remove the volumes too:
159165

160166
```sh
161-
$ docker-compose down --volumes
167+
$ docker compose down --volumes
162168
```
163169

164170
#### FAQ
@@ -172,7 +178,7 @@ This is probably because you have `git.autocrlf` set to true,
172178

173179
##### I see the error `/opt/rustwide/cargo-home/bin/cargo: cannot execute binary file: Exec format error` when running builds.
174180

175-
You are most likely not on a Linux platform. Running builds directly is only supported on `x86_64-unknown-linux-gnu`. On other platforms you can use the `docker-compose run web build [...]` workaround described above.
181+
You are most likely not on a Linux platform. Running builds directly is only supported on `x86_64-unknown-linux-gnu`. On other platforms you can use the `docker compose run web build [...]` workaround described above.
176182

177183
See [rustwide#41](https://github.com/rust-lang/rustwide/issues/41) for more details about supporting more platforms directly.
178184

@@ -200,11 +206,11 @@ cargo run -- start-web-server
200206
```sh
201207
# Builds <CRATE_NAME> <CRATE_VERSION> and adds it into database
202208
# This is the main command to build and add a documentation into docs.rs.
203-
# For example, `docker-compose run web build crate regex 1.1.6`
209+
# For example, `docker compose run web build crate regex 1.1.6`
204210
cargo run -- build crate <CRATE_NAME> <CRATE_VERSION>
205211

206212
# alternatively, via the web container
207-
docker-compose run web build crate <CRATE_NAME> <CRATE_VERSION>
213+
docker compose run web build crate <CRATE_NAME> <CRATE_VERSION>
208214

209215
# Builds every crate on crates.io and adds them into database
210216
# (beware: this may take months to finish)

0 commit comments

Comments
 (0)