-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(ansible/docker): split docker roles (#241)
* refactor(ansible/docker): split docker roles Signed-off-by: Kenji Miyake <[email protected]> * update README * fix name * fix README
- Loading branch information
1 parent
b892bea
commit 2b1d5ea
Showing
22 changed files
with
234 additions
and
204 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
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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
- hosts: localhost | ||
connection: local | ||
roles: | ||
- role: autoware.dev_env.docker | ||
- role: autoware.dev_env.docker_compose | ||
- role: autoware.dev_env.docker_engine | ||
- role: autoware.dev_env.nvidia_docker | ||
- role: autoware.dev_env.rocker |
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
This file was deleted.
Oops, something went wrong.
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,34 @@ | ||
# docker_compose | ||
|
||
This role installs Docker environment following [this page](https://docs.docker.com/engine/install/ubuntu/) and sets up rootless execution following [this page](https://docs.docker.com/engine/install/linux-postinstall/). | ||
|
||
Also, it installs some additional tools: | ||
|
||
- [Docker Compose](https://github.com/docker/compose) following the [installation guide](https://github.com/docker/compose#linux). | ||
|
||
## Inputs | ||
|
||
| Name | Required | Description | | ||
| ---------------------- | -------- | ------------------------------ | | ||
| docker_compose_version | false | The version of Docker Compose. | | ||
|
||
## Manual Installation | ||
|
||
Install Docker Compose: | ||
|
||
The `docker_compose_version` can also be found in: | ||
[./defaults/main.yaml](./defaults/main.yaml) | ||
|
||
```bash | ||
# Modified from: https://docs.docker.com/compose/cli-command/#install-on-linux | ||
|
||
# Run this command to download the Docker Compose: | ||
docker_compose_version=v2.2.2 | ||
sudo curl -SL https://github.com/docker/compose/releases/download/${docker_compose_version}/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose | ||
|
||
# Apply executable permissions to the binary: | ||
sudo chmod +x /usr/local/bin/docker-compose | ||
|
||
# Test the installation. | ||
docker-compose --version | ||
``` |
File renamed without changes.
Empty file.
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,7 @@ | ||
- name: Install Docker Compose | ||
become: true | ||
ansible.builtin.get_url: | ||
url: https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-{{ ansible_system }}-{{ ansible_architecture }} | ||
dest: /usr/local/bin/docker-compose | ||
force: true | ||
mode: 0775 |
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,57 @@ | ||
# docker_engine | ||
|
||
This role installs [Docker Engine](https://docs.docker.com/engine/) following the [installation guide](https://docs.docker.com/engine/install/ubuntu/) and sets up execution from non-root users following the [manual](https://docs.docker.com/engine/install/linux-postinstall/). | ||
|
||
## Inputs | ||
|
||
None. | ||
|
||
## Manual Installation | ||
|
||
Install Docker Engine: | ||
|
||
```bash | ||
# Taken from: https://docs.docker.com/engine/install/ubuntu/ | ||
# And: https://docs.docker.com/engine/install/linux-postinstall/ | ||
|
||
# Uninstall old versions | ||
sudo apt-get remove docker docker-engine docker.io containerd runc | ||
|
||
# Install using the repository | ||
sudo apt-get update | ||
|
||
sudo apt-get install \ | ||
ca-certificates \ | ||
curl \ | ||
gnupg \ | ||
lsb-release | ||
|
||
# Add Docker’s official GPG key: | ||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg | ||
|
||
# Install Docker Engine | ||
sudo apt-get update | ||
sudo apt-get install docker-ce docker-ce-cli containerd.io | ||
|
||
# Verify that Docker Engine is installed correctly by running the hello-world image. | ||
sudo docker run hello-world | ||
# Note: This command downloads a test image and runs it in a container. When the container runs, it prints a message and exits. | ||
``` | ||
|
||
Perform the post-installation steps: | ||
|
||
```bash | ||
# Post-installation steps for Linux | ||
|
||
# Create the docker group. | ||
sudo groupadd docker | ||
|
||
# Add your user to the docker group. | ||
sudo usermod -aG docker $USER | ||
|
||
# Log out and log back in so that your group membership is re-evaluated. | ||
|
||
# Verify that you can run docker commands without sudo | ||
docker run hello-world | ||
# Note: This command downloads a test image and runs it in a container. When the container runs, it prints a message and exits. | ||
``` |
Empty file.
Empty file.
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
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,53 @@ | ||
# nvidia_docker | ||
|
||
This role installs [NVIDIA Container Toolkit](https://github.com/NVIDIA/nvidia-docker) following the [installation guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker). | ||
|
||
## Inputs | ||
|
||
None. | ||
|
||
## Manual Installation | ||
|
||
Install Nvidia Container Toolkit: | ||
|
||
<!-- cspell:ignore Disp, Uncorr --> | ||
|
||
```bash | ||
# Taken from https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#setting-up-nvidia-container-toolkit | ||
|
||
# Setup the package repository and the GPG key: | ||
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \ | ||
&& curl -s -L https://nvidia.github.io/libnvidia-container/gpgkey | sudo apt-key add - \ | ||
&& curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list | ||
|
||
# Install the nvidia-docker2 package (and dependencies) after updating the package listing: | ||
sudo apt-get update | ||
sudo apt-get install -y nvidia-docker2 | ||
|
||
# Restart the Docker daemon to complete the installation after setting the default runtime: | ||
sudo systemctl restart docker | ||
|
||
# At this point, a working setup can be tested by running a base CUDA container: | ||
sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi | ||
|
||
# This should result in a console output shown below: | ||
# +-----------------------------------------------------------------------------+ | ||
# | NVIDIA-SMI 450.51.06 Driver Version: 450.51.06 CUDA Version: 11.0 | | ||
# |-------------------------------+----------------------+----------------------+ | ||
# | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | ||
# | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | ||
# | | | MIG M. | | ||
# |===============================+======================+======================| | ||
# | 0 Tesla T4 On | 00000000:00:1E.0 Off | 0 | | ||
# | N/A 34C P8 9W / 70W | 0MiB / 15109MiB | 0% Default | | ||
# | | | N/A | | ||
# +-------------------------------+----------------------+----------------------+ | ||
# | ||
# +-----------------------------------------------------------------------------+ | ||
# | Processes: | | ||
# | GPU GI CI PID Type Process name GPU Memory | | ||
# | ID ID Usage | | ||
# |=============================================================================| | ||
# | No running processes found | | ||
# +-----------------------------------------------------------------------------+ | ||
``` |
Empty file.
Empty file.
Oops, something went wrong.