Skip to content

Commit 72ef015

Browse files
Nemo157syphar
authored andcommitted
Update readme for docker-compose v2
1 parent 57d5b50 commit 72ef015

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
@@ -129,19 +128,26 @@ npm install browser-ui-test
129128

130129
### Pure docker-compose
131130

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

137136
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):
138137
```sh
139138
# run a build for a single crate
140-
docker-compose run web build crate regex 1.3.1
139+
docker compose run web build crate regex 1.3.1
141140
# or build essential files
142-
docker-compose run web build add-essential-files
141+
docker compose run web build add-essential-files
143142
# rebuild the web container when you changed code.
144-
docker-compose build web
143+
docker compose up -d web --build
144+
```
145+
146+
You can also run other commands like the setup above from within the container:
147+
148+
```sh
149+
docker compose run --rm cli database migrate
150+
docker compose run --rm cli build update-toolchain
145151
```
146152

147153
Note that running tests is not supported when using pure docker-compose.
@@ -163,14 +169,14 @@ Three services are defined:
163169

164170
#### Rebuilding Containers
165171

166-
To rebuild the site, run `docker-compose build`.
172+
To rebuild the site, run `docker compose build`.
167173
Note that docker-compose caches the build even if you change the source code,
168174
so this will be necessary anytime you make changes.
169175

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

172178
```sh
173-
$ docker-compose down --volumes
179+
$ docker compose down --volumes
174180
```
175181

176182
#### FAQ
@@ -184,7 +190,7 @@ This is probably because you have `git.autocrlf` set to true,
184190

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

187-
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.
193+
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.
188194

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

@@ -212,11 +218,11 @@ cargo run -- start-web-server
212218
```sh
213219
# Builds <CRATE_NAME> <CRATE_VERSION> and adds it into database
214220
# This is the main command to build and add a documentation into docs.rs.
215-
# For example, `docker-compose run web build crate regex 1.1.6`
221+
# For example, `docker compose run web build crate regex 1.1.6`
216222
cargo run -- build crate <CRATE_NAME> <CRATE_VERSION>
217223

218224
# alternatively, via the web container
219-
docker-compose run web build crate <CRATE_NAME> <CRATE_VERSION>
225+
docker compose run web build crate <CRATE_NAME> <CRATE_VERSION>
220226

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

0 commit comments

Comments
 (0)