74 lines
1.5 KiB
Markdown
74 lines
1.5 KiB
Markdown
Docker Container
|
|
=========
|
|
|
|
Deploy docker containers on Ubuntu 24.04.
|
|
|
|
Requirements
|
|
------------
|
|
|
|
Docker engine must be insalled on the host this role will run on.
|
|
|
|
Role Variables
|
|
--------------
|
|
|
|
The following variables will be equivalent to `docker.io/ubuntu/nginx:latest`.
|
|
|
|
Docker registry base url (default: docker.io):
|
|
`docker_container_registry: docker.io`
|
|
|
|
Docker rebpository namespace (default: ""):
|
|
`docker_container_repository_namespace: ubuntu`
|
|
|
|
Docker repository name (default: ubuntu):
|
|
`docker_container_repository_name: nginx`
|
|
|
|
Docker container tag (default: latest):
|
|
`docker_container_repository_tag: latest`
|
|
|
|
Docker container options to pass to docker run command (default: undefined):
|
|
`docker_container_run_options: "-p 8080:8080"`
|
|
|
|
Default image: `docker.io/ubuntu:latest`.
|
|
|
|
Dependencies
|
|
------------
|
|
|
|
No dependencies.
|
|
|
|
Example Playbook
|
|
----------------
|
|
|
|
```
|
|
---
|
|
- hosts: goapp
|
|
|
|
vars:
|
|
docker_container_registry: docker.io
|
|
docker_container_repository_name: ubuntu
|
|
docker_container_repository_tag: latest
|
|
docker_container_run_options: "-p 8080:8080"
|
|
|
|
pre_tasks:
|
|
- name: Update apt cache.
|
|
ansible.builtin.apt:
|
|
update_cache: true
|
|
cache_valid_time: 86400
|
|
|
|
roles:
|
|
- role: cuqmbr.docker_container
|
|
```
|
|
|
|
TODO
|
|
----
|
|
|
|
Add support for other Linux distrubitions:
|
|
|
|
- RHEL: Almalinux, RockyLinux 9 and 8
|
|
- Debian: Debian 12 and 11, Ubuntu 24.04 and 22.04
|
|
- Archlinux
|
|
|
|
Make role more generic:
|
|
|
|
- Add dockerd parameters configuration
|
|
- Add `docker container run` parameters configuration
|