-
Notifications
You must be signed in to change notification settings - Fork 511
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Examples] Add docker compose example to run multiple containers (#2745)
* Add docker compose example * newline * Add repo setup for AWS * Change CUDA to 11.5 for azure compat * Add device_id * typo
- Loading branch information
1 parent
d80c47b
commit 5a35ab6
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Minimal example using docker compose to run multiple containers | ||
# | ||
# Syncs the docker-compose.yml in the current workdir to the remote cluster and | ||
# runs docker compose up. | ||
# | ||
# Usage: | ||
# sky launch -c myclus compose_example.yaml | ||
# sky down myclus | ||
|
||
resources: | ||
accelerators: T4:2 | ||
|
||
workdir: . | ||
|
||
setup: | | ||
sudo apt-get update | ||
sudo apt-get install -y ca-certificates curl gnupg | ||
sudo install -m 0755 -d /etc/apt/keyrings | ||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | ||
sudo chmod a+r /etc/apt/keyrings/docker.gpg | ||
echo \ | ||
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ | ||
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ | ||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | ||
sudo apt-get update | ||
sudo apt-get install -y docker-compose-plugin | ||
run: | | ||
docker compose -f docker-compose.yml up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
version: '3.8' | ||
|
||
services: | ||
gpu-app1: | ||
image: nvidia/cuda:11.5.2-runtime-ubuntu20.04 | ||
command: nvidia-smi # To keep running in a loop, add -l 1 | ||
deploy: | ||
resources: | ||
reservations: | ||
devices: | ||
- driver: nvidia | ||
device_ids: ['0'] | ||
capabilities: [gpu] | ||
|
||
gpu-app2: | ||
image: nvidia/cuda:11.5.2-runtime-ubuntu20.04 | ||
command: nvidia-smi | ||
deploy: | ||
resources: | ||
reservations: | ||
devices: | ||
- driver: nvidia | ||
device_ids: ['1'] # Allocates GPU ID 1 to this container. Inside the container, this will be visible as device id 0 | ||
capabilities: [gpu] |