Giter VIP home page Giter VIP logo

docker-debian8-ansible's Introduction

Debian 8 (Jessie) Ansible Test Image

Build Status Docker Automated build

Debian 8 (Jessie) Docker container for Ansible playbook and role testing.

How to Build

This image is built on Docker Hub automatically any time the upstream OS container is rebuilt, and any time a commit is made or merged to the master branch. But if you need to build the image on your own locally, do the following:

  1. Install Docker.
  2. cd into this directory.
  3. Run docker build -t debian8-ansible .

Note: Switch between master and testing depending on whether you want the extra testing tools present in the resulting image.

How to Use

  1. Install Docker.
  2. Pull this image from Docker Hub: docker pull geerlingguy/docker-debian8-ansible:latest (or use the image you built earlier, e.g. debian8-ansible).
  3. Run a container from the image: docker run --detach --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro geerlingguy/docker-debian8-ansible:latest /lib/systemd/systemd (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

Notes

I use Docker to test my Ansible roles and playbooks on multiple OSes using CI tools like Jenkins and Travis. This container allows me to test roles and playbooks using Ansible running locally inside the container.

Important Note: I use this image for testing in an isolated environment—not for production—and the settings and configuration used may not be suitable for a secure and performant production environment. Use on production servers/in the wild at your own risk!

Author

Created in 2016 by Jeff Geerling, author of Ansible for DevOps.

docker-debian8-ansible's People

Contributors

geerlingguy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docker-debian8-ansible's Issues

Debian8 command error

I beg your pardon, but when I try to launch I have the error below.

$> docker run --detach --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro geerlingguy/docker-debian8-ansible:latest /usr/lib/systemd/systemd
5be01772c1cd8c274716b2a8bc28842d85a815edc34ae727444159e8a2c00e38
docker: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"/usr/lib/systemd/systemd\\\": stat /usr/lib/systemd/systemd: no such file or directory\"\n".
$> docker run --detach --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro geerlingguy/docker-debian8-ansible:latest /lib/systemd/systemd
ab48c4f7a383cb2fda45e084a9c85e4e325951d8cc2b1c5fafb8380c4896076b

I am not sure, but I think you should correct /usr/lib/systemd/systemd into /lib/systemd/systemd.

Automated build failing when installing cryptography

Example (from: https://travis-ci.org/geerlingguy/docker-debian8-ansible/builds/291270125):

Step 6/9 : RUN pip install ansible cryptography
 ---> Running in 956a7f273ea4
Downloading/unpacking ansible
 Running setup.py (path:/tmp/pip-build-Vtb20J/ansible/setup.py) egg_info for package ansible
 no previously-included directories found matching 'ticket_stubs'
 no previously-included directories found matching 'hacking'
 'test/integration/targets/unarchive/files/test-unarchive-nonascii-くらとみ.tar.gz' not ANSI_X3.4-1968 encodable -- skipping
Downloading/unpacking cryptography
 Running setup.py (path:/tmp/pip-build-Vtb20J/cryptography/setup.py) egg_info for package cryptography
 error in cryptography setup command: Invalid environment marker: python_version < '3'
 Complete output from command python setup.py egg_info:
 error in cryptography setup command: Invalid environment marker: python_version < '3'
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-Vtb20J/cryptography
Traceback (most recent call last):
 File "/usr/bin/pip", line 9, in <module>
 load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
 File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 248, in main
 return command.main(cmd_args)
 File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
 text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 70: ordinal not in range(128)
The command '/bin/sh -c pip install ansible cryptography' returned a non-zero code: 1

I can reproduce the error locally and when run via the Docker Hub automated image build.

Archive this repository by June 30, 2020

In less than a month, Debian 8 'Jessie' LTS will no longer be actively maintained. Therefore I would like to deprecate and archive this repo and docker image, since I just started getting Python 2-related build failures and it's not worth the effort to get everything upgraded (and break half the world that uses this image) for less than a month's usage.

Can't install libssl-dev on this Docker image

See details here: gplessis/dotdeb-php#146

Basically, the following works (from the official Debian image):

  1. docker pull debian:jessie
  2. docker run --detach --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro debian:jessie /lib/systemd/systemd
  3. docker exec --tty [id] env TERM=xterm apt-get -y update
  4. docker exec --tty [id] env TERM=xterm apt-get -y install libssl-dev

While the following doesn't (using this Docker image):

  1. docker pull geerlingguy/docker-debian8-ansible:latest
  2. docker run --detach --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro geerlingguy/docker-debian8-ansible:latest /lib/systemd/systemd
  3. docker exec --tty [id] env TERM=xterm apt-get -y update
  4. docker exec --tty [id] env TERM=xterm apt-get -y install libssl-dev

The latter results in:

$ docker exec --tty 3c808f66 env TERM=xterm apt-get -y install libssl-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libssl-dev : Depends: libssl1.0.0 (= 1.0.1t-1+deb8u2) but 1.0.2h-1~bpo8+2 is to be installed
              Recommends: libssl-doc but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

apt-get update fails

apt-get update fails, as there seems to be an issue with the source file.

This seems to solve the issue: https://superuser.com/questions/1423486/issue-with-fetching-http-deb-debian-org-debian-dists-jessie-updates-inrelease

W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/InRelease  Unable to find expected entry 'main/binary-amd64/Packages' in Release file (Wrong sources.list entry or malformed file)

E: Some index files failed to download. They have been ignored, or old ones used instead.

Build failing while running cryptography/setup.py

Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-QGgXAV/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lF0UHz-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-QGgXAV/cryptography
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 248, in main
    return command.main(cmd_args)
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 50: ordinal not in range(128)
The command '/bin/sh -c pip install --upgrade setuptools     && pip install $pip_packages' returned a non-zero code: 1
The command "docker build -t docker-ansible ." exited with 1.

From build: https://travis-ci.org/geerlingguy/docker-debian8-ansible/builds/616404014

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.