Skip to content

Commit 92e502b

Browse files
committed
Update readme for docker-compose v2
1 parent 30e2f2c commit 92e502b

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
@@ -64,8 +64,7 @@ mkdir -p ignored/cratesfyi-prefix/crates.io-index
6464
# Builds the docs.rs binary
6565
cargo build
6666
# Start the external services.
67-
# It may be `docker compose` in newer versions
68-
docker-compose up -d db s3
67+
docker compose up -d db s3
6968
# anything that doesn't run via docker-compose needs the settings defined in
7069
# .env. Either via `. ./.env` as below, or via any dotenv shell integration.
7170
. ./.env
@@ -102,19 +101,26 @@ cargo test
102101

103102
### Pure docker-compose
104103

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

110109
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):
111110
```sh
112111
# run a build for a single crate
113-
docker-compose run web build crate regex 1.3.1
112+
docker compose run web build crate regex 1.3.1
114113
# or build essential files
115-
docker-compose run web build add-essential-files
114+
docker compose run web build add-essential-files
116115
# rebuild the web container when you changed code.
117-
docker-compose build web
116+
docker compose up -d web --build
117+
```
118+
119+
You can also run other commands like the setup above from within the container:
120+
121+
```sh
122+
docker compose run --rm cli database migrate
123+
docker compose run --rm cli build update-toolchain
118124
```
119125

120126
Note that running tests is not supported when using pure docker-compose.
@@ -136,14 +142,14 @@ Three services are defined:
136142

137143
#### Rebuilding Containers
138144

139-
To rebuild the site, run `docker-compose build`.
145+
To rebuild the site, run `docker compose build`.
140146
Note that docker-compose caches the build even if you change the source code,
141147
so this will be necessary anytime you make changes.
142148

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

145151
```sh
146-
$ docker-compose down --volumes
152+
$ docker compose down --volumes
147153
```
148154

149155
#### FAQ
@@ -157,7 +163,7 @@ This is probably because you have `git.autocrlf` set to true,
157163

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

160-
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.
166+
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.
161167

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

@@ -185,11 +191,11 @@ cargo run -- start-web-server
185191
```sh
186192
# Builds <CRATE_NAME> <CRATE_VERSION> and adds it into database
187193
# This is the main command to build and add a documentation into docs.rs.
188-
# For example, `docker-compose run web build crate regex 1.1.6`
194+
# For example, `docker compose run web build crate regex 1.1.6`
189195
cargo run -- build crate <CRATE_NAME> <CRATE_VERSION>
190196

191197
# alternatively, via the web container
192-
docker-compose run web build crate <CRATE_NAME> <CRATE_VERSION>
198+
docker compose run web build crate <CRATE_NAME> <CRATE_VERSION>
193199

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

0 commit comments

Comments
 (0)