Skip to content

Commit 709e183

Browse files
Change all docker-compose (v1) command examples to docker compose (v2)
1 parent 1443513 commit 709e183

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The main goal of this project is to have a single Docker image to develop all yo
44

55
The Docker container also provides developer-friendly tools and behaviours like persisted **Ruby console history** (IRB and Pry), **shell history**, or even auto-installing dependencies (that's right: simply change your `Gemfile` or `package.json` and **`bundle install` or `yarn install` will be run automatically** for you and only when necessary). It also provides a few CLI tools to get your hands dirty, but as least as possible: `vim`, `nano`, `heroku`.
66

7-
The default command (when you just `docker-compose up`) is to run `foreman start`, thus starting whatever you put in your `Procfile` (except the `release` process, if you have one: it's a reserved process name by Heroku/Dokku). All commands are run inside the container **as the same user that owns your codebase** (thus probably your host user), which means that any file generated inside the container (think of `rails generate`, `yarn init`, or even log files) will be owned by yourself (not by `root`, like they would with a default Docker configuration).
7+
The default command (when you just `docker compose up`) is to run `foreman start`, thus starting whatever you put in your `Procfile` (except the `release` process, if you have one: it's a reserved process name by Heroku/Dokku). All commands are run inside the container **as the same user that owns your codebase** (thus probably your host user), which means that any file generated inside the container (think of `rails generate`, `yarn init`, or even log files) will be owned by yourself (not by `root`, like they would with a default Docker configuration).
88

99
We try to use sane default conventions so you don't have to think about it, but this image also allows some configuration (_e.g._ Heroku CLI or Git authentication) and [customisation](#customisation) (install extra software inside the container). See the [recipes book](RECIPES.md) for more details.
1010

@@ -50,21 +50,21 @@ services:
5050
You can now start your project with:
5151

5252
```shell
53-
docker-compose up
53+
docker compose up
5454
```
5555

5656
Or run any command (like `rake`, `bash`, or whatever else) with:
5757

5858
```shell
59-
docker-compose run app [rake|bash|...]
59+
docker compose run app [rake|bash|...]
6060
```
6161

6262
> 💡 Note that you don't need to prefix commands with `bundle exec`.
6363

6464
You can even bypass dependencies check/auto-install before the command is run by setting the `DISABLE_AUTO_INSTALL_DEPS` environment variable from the command-line:
6565

6666
```shell
67-
docker-compose run -e DISABLE_AUTO_INSTALL_DEPS=1 app bash
67+
docker compose run -e DISABLE_AUTO_INSTALL_DEPS=1 app bash
6868
```
6969

7070
## Customisation
@@ -101,7 +101,7 @@ You can customise this image by **building your own image based on this one** (o
101101
> 1. Run a shell as root in the container (notice the empty entrypoint):
102102
>
103103
> ```shell
104-
> docker-compose run --entrypoint= app bash
104+
> docker compose run --entrypoint= app bash
105105
> ```
106106
>
107107
> 2. Install the pakckage using APT (any change will be undone when you close the shell):

RECIPES.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Please refer to [README.md](README.md) for generic overview, setup and usage ins
4747
3. Install Rails and generate your Rails application (it replaces the usual `gem install rails && rails new my_project` command that you will find in every documentation and tutorial out there):
4848

4949
```shell
50-
docker-compose run app bash -c "bundle init && bundle add rails && rails new . --force --skip-spring"
50+
docker compose run app bash -c "bundle init && bundle add rails && rails new . --force --skip-spring"
5151
```
5252

5353
> 💡 You can specify the Rails version you want by appending the [`--version` switch](https://bundler.io/v1.16/man/bundle-add.1.html#OPTIONS) to the `bundle add rails` command (_e.g._ `--version "~> 5.2.0"`).
@@ -64,7 +64,7 @@ Please refer to [README.md](README.md) for generic overview, setup and usage ins
6464
6565
> ⚠️ Whatever you do in this `Procfile`, always configure your servers to listen on `0.0.0.0` (`puma` [does it](https://github.com/puma/puma/blob/8dbc6eb6ed96b2cefa7092dd398ea2c0a4a0be80/lib/puma/configuration.rb#L10) by default but using `rails server` [forces it](https://github.com/rails/rails/blob/b10f371366a606310cab26648d798836e030bdc8/railties/lib/rails/commands/server/server_command.rb#L236) to listen to `localhost`, unless you override it again using the `-b|--binding` switch like above). Without it, you won't be able to connect to this server from outside the running container.
6666

67-
5. Run `docker-compose up app` as usual and you're [good to profit 🎉](http://localhost:5000).
67+
5. Run `docker compose up app` as usual and you're [good to profit 🎉](http://localhost:5000).
6868
6969
### Creating a gem from scratch
7070
@@ -93,7 +93,7 @@ Please refer to [README.md](README.md) for generic overview, setup and usage ins
9393
3. Generate your gem skeleton (it just needs to trick `bundler` to think that the current directory is available as a subdirectory named `my_project`):
9494
9595
```shell
96-
docker-compose run app bash -c "ln -s . my_project && bundle gem my_project && rm my_project"
96+
docker compose run app bash -c "ln -s . my_project && bundle gem my_project && rm my_project"
9797
```
9898
9999
### Using Webpacker
@@ -271,7 +271,7 @@ Here is what it does:
271271
- postgres
272272
```
273273
274-
You can now start PGAdmin using the usual command `docker-compose up pgadmin` then access it on http://localhost:5050 🐘 (from where you can configure it to connect to the PostgreSQL server on host `postgres` with user `postgres` and no password).
274+
You can now start PGAdmin using the usual command `docker compose up pgadmin` then access it on http://localhost:5050 🐘 (from where you can configure it to connect to the PostgreSQL server on host `postgres` with user `postgres` and no password).
275275
276276
### Using MailCatcher
277277
@@ -329,7 +329,7 @@ Your application will now send all emails to MailCatcher SMTP server and you can
329329
330330
## Configuration
331331
332-
Most configurations can be done from a `docker-compose.override.yml` file alongside your `docker-compose.yml` file (by default, it will be [automatically read](https://docs.docker.com/compose/extends/#multiple-compose-files) by `docker-compose`, and it should probably be [gitignore'd globally](https://help.github.com/articles/ignoring-files/#create-a-global-gitignore)).
332+
Most configurations can be done from a `docker-compose.override.yml` file alongside your `docker-compose.yml` file (by default, it will be [automatically read](https://docs.docker.com/compose/extends/#multiple-compose-files) by `docker compose`, and it should probably be [gitignore'd globally](https://help.github.com/articles/ignoring-files/#create-a-global-gitignore)).
333333
334334
### Heroku CLI authentication
335335
@@ -447,24 +447,24 @@ services:
447447
First of all, make sure your development database exists and is empty:
448448
449449
```shell
450-
docker-compose run -e DISABLE_AUTO_INSTALL_DEPS=1 -e PGHOST=postgres -e PGUSER=postgres app dropdb app_development
451-
docker-compose run -e DISABLE_AUTO_INSTALL_DEPS=1 -e PGHOST=postgres -e PGUSER=postgres app createdb app_development
450+
docker compose run -e DISABLE_AUTO_INSTALL_DEPS=1 -e PGHOST=postgres -e PGUSER=postgres app dropdb app_development
451+
docker compose run -e DISABLE_AUTO_INSTALL_DEPS=1 -e PGHOST=postgres -e PGUSER=postgres app createdb app_development
452452
```
453453
454454
### Load a database dump
455455
456456
To copy a database dump (_e.g._ `latest.dump`) to your local Postgres development database, use [`pg_restore`](https://www.postgresql.org/docs/current/app-pgrestore.html):
457457
458458
```shell
459-
docker-compose run -e DISABLE_AUTO_INSTALL_DEPS=1 -e PGHOST=postgres -e PGUSER=postgres app pg_restore --verbose --clean --no-acl --no-owner -d app_development latest.dump
459+
docker compose run -e DISABLE_AUTO_INSTALL_DEPS=1 -e PGHOST=postgres -e PGUSER=postgres app pg_restore --verbose --clean --no-acl --no-owner -d app_development latest.dump
460460
```
461461
462462
### Fetch and load a Heroku database
463463
464464
To copy a Postgres database from Heroku to your local development environment (assuming you followed the Postgres config from the [using PostgreSQL](#using-postgresql) section), use [`heroku pg:pull`](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-pg-pull-source-target):
465465
466466
```shell
467-
docker-compose run -e PGSSLMODE=prefer -e DISABLE_AUTO_INSTALL_DEPS=1 app heroku pg:pull DATABASE_URL postgres://postgres:password@postgres/app_development -a your-heroku-app
467+
docker compose run -e PGSSLMODE=prefer -e DISABLE_AUTO_INSTALL_DEPS=1 app heroku pg:pull DATABASE_URL postgres://postgres:password@postgres/app_development -a your-heroku-app
468468
```
469469
470470
> ℹ️ You need [Heroku CLI authentication](#heroku-cli-authentication) configured for this to work.

0 commit comments

Comments
 (0)