Skip to content

Commit d88d4e1

Browse files
committed
docker compose edit
1 parent b597a6c commit d88d4e1

File tree

8 files changed

+21
-21
lines changed

8 files changed

+21
-21
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,34 +64,34 @@ KAGGLE_KEY=<your_kaggle_key>
6464

6565
This codebase is designed to be run with [Docker](https://docs.docker.com/get-docker/).
6666

67-
If you've never used Docker before, don't worry! I have included a guide to Docker in the [Docker README](./docs/docker.md) file in this repository. This includes a full run through of why Docker is awesome and a brief guide to the `Dockerfile` and `docker-compose.yml` for this project.
67+
If you've never used Docker before, don't worry! I have included a guide to Docker in the [Docker README](./docs/docker.md) file in this repository. This includes a full run through of why Docker is awesome and a brief guide to the `Dockerfile` and `docker compose.yml` for this project.
6868

6969
### Building the Docker image
7070

7171
If you do not have a GPU, run the following command:
7272

7373
```
74-
docker-compose build
74+
docker compose build
7575
```
7676

7777
If you do have a GPU that you wish to use, run the following command:
7878

7979
```
80-
docker-compose -f docker-compose-gpu.yml build
80+
docker compose -f docker compose-gpu.yml build
8181
```
8282

8383
### Running the container
8484

8585
If you do not have a GPU, run the following command:
8686

8787
```
88-
docker-compose up
88+
docker compose up
8989
```
9090

9191
If you do have a GPU that you wish to use, run the following command:
9292

9393
```
94-
docker-compose -f docker-compose-gpu.yml up
94+
docker compose -f docker compose-gpu.yml up
9595
```
9696

9797
Jupyter will be available in your local browser, on the port specified in your env file - for example

docs/docker.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ ENV PYTHONPATH="${PYTHONPATH}:/app" #<7>
6969

7070
You can see how the Dockerfile can be thought of as a recipe for building a particular run-time environment. The magic of Docker is that you do not need to worry about installing a resource intensive virtual machine on your computer - Docker is lightweight and allows you to build an environment template purely using code.
7171

72-
A running version of an image is called a *container*. You can think of the image as like a cookie cutter, that can be used to create a particular cookie (the container). There is one other file that we need to look at before we finally get to build our image and run the container - the docker-compose.yaml file.
72+
A running version of an image is called a *container*. You can think of the image as like a cookie cutter, that can be used to create a particular cookie (the container). There is one other file that we need to look at before we finally get to build our image and run the container - the docker compose.yaml file.
7373

74-
## 🎼 The docker-compose.yaml file
74+
## 🎼 The docker compose.yaml file
7575

76-
Docker Compose is an extension to Docker that allows you to define how you would like your containers to run, through a simple YAML file, called 'docker-compose.yaml'.
76+
Docker Compose is an extension to Docker that allows you to define how you would like your containers to run, through a simple YAML file, called 'docker compose.yaml'.
7777

7878
For example, you can specify which ports and folders should be mapped between your machine and the container. Folder mapping allows the container to treat folders on your machine as if they were folders inside the container. Therefore any changes you make to mapped files and folders on your machine will be immediately reflected inside the container. Port mapping will forward any traffic on a local port through to the container. For example, we could map port 8888 on your local machine to port 8888 in the container, so that if you visit `localhost:8888` in your browser, you will see Jupyter, which is running on port 8888 inside the container. The ports do not have have to be the same - for example you could map port 8000 to port 8888 in the container if you wanted.
7979

@@ -104,7 +104,7 @@ services: #<2>
104104
1. This specifies the version of Docker Compose to use (currently version 3)
105105
2. Here, we specify the services we wish to launch
106106
3. We only have one service, which we call `app`
107-
4. Here, we tell Docker where to find the Dockerfile (the same directory as the docker-compose.yaml file)
107+
4. Here, we tell Docker where to find the Dockerfile (the same directory as the docker compose.yaml file)
108108
5. This allows us to open up an interactive command line inside the container, if we wish
109109
6. Here, we map folders on our local machine (e.g. ./data), to folders inside the container (e.g. /app/data).
110110
7. Here, we specify the port mappings - the dollar sign means that it will use the ports as specified in the `.env` file (e.g. `JUPYTER_PORT=8888`)
@@ -129,22 +129,22 @@ docker compose up
129129

130130
You should see that Docker launches the Jupyter notebook server within the container and provides you with a URL to the running server.
131131

132-
Because we have mapped port 8888 in the container to port 8888 on your machine, you can simply navigate to the address starting `http://127.0.0.1:8888/lab?token=` into a web browser and you should see the running Jupyter server. The folders that we mapped across in the `docker-compose.yaml` file should be visible on the left hand side.
132+
Because we have mapped port 8888 in the container to port 8888 on your machine, you can simply navigate to the address starting `http://127.0.0.1:8888/lab?token=` into a web browser and you should see the running Jupyter server. The folders that we mapped across in the `docker compose.yaml` file should be visible on the left hand side.
133133

134134
Congratulations! You now have a functioning Docker container that you can use to start working through the Generative Deep Learning codebase! To stop running the Jupyter server, you use `Ctrl-C` and to bring down the running container, you use the command `docker compose down`. Because the volumes are mapped, you won't lose any of your work that you save whilst working in the Jupyter notebooks, even if you bring the container down.
135135

136136
## ⚡️ Using a GPU
137137

138-
The default `Dockerfile` and `docker-compose.yaml` file assume that you do not want to use a local GPU to train your models. If you do have a GPU that you wish to use (for example, you are using a cloud VM), I have provided two extra files called `Dockerfile-gpu` and `docker-compose-gpu.yaml` files that can be used in place of the default files.
138+
The default `Dockerfile` and `docker compose.yaml` file assume that you do not want to use a local GPU to train your models. If you do have a GPU that you wish to use (for example, you are using a cloud VM), I have provided two extra files called `Dockerfile-gpu` and `docker compose-gpu.yaml` files that can be used in place of the default files.
139139

140140
For example, to build an image that includes support for GPU, use the command shown below:
141141

142142
```
143-
docker-compose -f docker-compose-gpu.yml build
143+
docker compose -f docker compose-gpu.yml build
144144
```
145145

146146
To run this image, use the following command:
147147

148148
```
149-
docker-compose -f docker-compose-gpu.yml up
149+
docker compose -f docker compose-gpu.yml up
150150
```

docs/googlecloud.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Lastly, you'll need to make sure that Docker Compose is installed on the virtual
8383

8484
```
8585
sudo apt-get update
86-
sudo apt-get install docker-compose-plugin
86+
sudo apt-get install docker compose-plugin
8787
```
8888

8989
Now you can build the image and run the container, using the GPU-specific commands discussed in the main `README` of this codebase.

scripts/downloaders/download_bach_cello_data.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
docker-compose exec app bash -c "
1+
docker compose exec app bash -c "
22
mkdir /app/data/bach-cello/
33
cd /app/data/bach-cello/ &&
44
echo 'Downloading...' &&

scripts/downloaders/download_bach_chorale_data.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
docker-compose exec app bash -c "
1+
docker compose exec app bash -c "
22
mkdir /app/data/bach-chorales/
33
cd /app/data/bach-chorales/ &&
44
echo 'Downloading...' &&
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
USER=$1
22
DATASET=$2
33

4-
docker-compose exec app bash -c "cd /app/data/ && kaggle datasets download -d $USER/$DATASET && echo 'Unzipping...' && unzip -q -o /app/data/$DATASET.zip -d /app/data/$DATASET && rm /app/data/$DATASET.zip && echo '🚀 Done!'"
4+
docker compose exec app bash -c "cd /app/data/ && kaggle datasets download -d $USER/$DATASET && echo 'Unzipping...' && unzip -q -o /app/data/$DATASET.zip -d /app/data/$DATASET && rm /app/data/$DATASET.zip && echo '🚀 Done!'"
55

scripts/format.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
docker-compose exec app black -l 80 .
2-
docker-compose exec app flake8 --max-line-length=80 --exclude=./data --ignore=W503,E203,E402
3-
docker-compose exec app flake8_nb --max-line-length=80 --exclude=./data --ignore=W503,E203,E402
1+
docker compose exec app black -l 80 .
2+
docker compose exec app flake8 --max-line-length=80 --exclude=./data --ignore=W503,E203,E402
3+
docker compose exec app flake8_nb --max-line-length=80 --exclude=./data --ignore=W503,E203,E402

scripts/tensorboard.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
CHAPTER=$1
22
EXAMPLE=$2
33
echo "Attaching Tensorboard to ./notebooks/$CHAPTER/$EXAMPLE/logs/"
4-
docker-compose exec -e CHAPTER=$CHAPTER -e EXAMPLE=$EXAMPLE app bash -c 'tensorboard --logdir "./notebooks/$CHAPTER/$EXAMPLE/logs" --host 0.0.0.0 --port $TENSORBOARD_PORT'
4+
docker compose exec -e CHAPTER=$CHAPTER -e EXAMPLE=$EXAMPLE app bash -c 'tensorboard --logdir "./notebooks/$CHAPTER/$EXAMPLE/logs" --host 0.0.0.0 --port $TENSORBOARD_PORT'

0 commit comments

Comments
 (0)