Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,19 @@ This image is built on Docker Hub automatically any time the upstream OS contain
1. [Install Docker](https://docs.docker.com/engine/installation/).
2. Pull this image from Docker Hub: `docker pull geerlingguy/docker-centos7-ansible:latest` (or use the image you built earlier, e.g. `centos7-ansible:latest`).
3. Run a container from the image: `docker run --detach --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro geerlingguy/docker-centos7-ansible:latest` (to test my Ansible roles, I add in a volume mounted from the current working directory with ``--volume=`pwd`:/etc/ansible/roles/role_under_test:ro``).
4. Use Ansible inside the container:
a. `docker exec --tty [container_id] env TERM=xterm ansible --version`
b. `docker exec --tty [container_id] env TERM=xterm ansible-playbook /path/to/ansible/playbook.yml --syntax-check`
4. Use commands such as `ansible` and `ansible-playbook` inside the container:

```
# Run `ansible --version`
docker exec --tty [container_id] env TERM=xterm ansible --version`

# Run `ansible-playbook /path/to/ansible/playbook.yml --syntax-check`
docker exec --tty [container_id] env TERM=xterm ansible-playbook /path/to/ansible/playbook.yml --syntax-check`

# Enter a shell in the container.
docker exec --tty -i [container_id] env TERM=xterm bash

```

## Notes

Expand Down