Skip to content

Commit 5882671

Browse files
committed
Update readme for docker-compose v2
1 parent e1be43f commit 5882671

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
@@ -111,19 +110,26 @@ can take a look at its documentation [here](https://github.com/GuillaumeGomez/br
111110

112111
### Pure docker-compose
113112

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

119118
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):
120119
```sh
121120
# run a build for a single crate
122-
docker-compose run web build crate regex 1.3.1
121+
docker compose run web build crate regex 1.3.1
123122
# or build essential files
124-
docker-compose run web build add-essential-files
123+
docker compose run web build add-essential-files
125124
# rebuild the web container when you changed code.
126-
docker-compose build web
125+
docker compose up -d web --build
126+
```
127+
128+
You can also run other commands like the setup above from within the container:
129+
130+
```sh
131+
docker compose run --rm cli database migrate
132+
docker compose run --rm cli build update-toolchain
127133
```
128134

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

146152
#### Rebuilding Containers
147153

148-
To rebuild the site, run `docker-compose build`.
154+
To rebuild the site, run `docker compose build`.
149155
Note that docker-compose caches the build even if you change the source code,
150156
so this will be necessary anytime you make changes.
151157

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

154160
```sh
155-
$ docker-compose down --volumes
161+
$ docker compose down --volumes
156162
```
157163

158164
#### FAQ
@@ -166,7 +172,7 @@ This is probably because you have `git.autocrlf` set to true,
166172

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

169-
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.
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.
170176

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

@@ -194,11 +200,11 @@ cargo run -- start-web-server
194200
```sh
195201
# Builds <CRATE_NAME> <CRATE_VERSION> and adds it into database
196202
# This is the main command to build and add a documentation into docs.rs.
197-
# For example, `docker-compose run web build crate regex 1.1.6`
203+
# For example, `docker compose run web build crate regex 1.1.6`
198204
cargo run -- build crate <CRATE_NAME> <CRATE_VERSION>
199205

200206
# alternatively, via the web container
201-
docker-compose run web build crate <CRATE_NAME> <CRATE_VERSION>
207+
docker compose run web build crate <CRATE_NAME> <CRATE_VERSION>
202208

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

0 commit comments

Comments
 (0)