Install docker with standrad user using ansible playbook
New on LowEndTalk? Please read our 'Community Rules' by clicking on it in the right menu!

Install docker with standrad user using ansible playbook

Hi all,

I want to share one small playbook with you, it will help you with installation of new Debian 8 server and if you need docker and docker-composer installed with only one command.

Task in this playbook are

  1. Update && upgrade
  2. Install debian keyrings
  3. Install dependency
  4. Add docker and backports repository
  5. Install and pip upgrade (to get last version of docker-compose)
  6. Add your user to docker group (no need to run docker daemon as root in most of the cases)
  7. Reboot your server after all settings and start docker-engine

You will need ansible 2.2+ and Debian 8 (tested with Debian 8.6)

How to use

Clone repo

  • Folder debian-docker

You will need to add ssh key to your Debian machine:

ssh-copy-id -i ~/.ssh/id_rsa [email protected]

If you don't have ssh key:

ssh-keygen -t rsa -b 4096

After this you will need to edit /etc/ansible/hosts file(set your server info):


debian ansible_host=server_ip ansible_user=server_user_name ansible_su_pass=user_password ansible_ssh_private_key_file=~/.ssh/id_rsa

Edit vars in debian-docker/roles/docker/vars/main.yml

host_ip: your_server_ip

user: server_nonroot_user

Run playbook:

ansible-playbook install-docker-debian8-playbook.yml

Have a nice day/night!

Pentesting with open source, BackBox Linux

Thanked by 2deadbeef ehab


  • Just small update, in same repository now you can find install Google Cloud SDK role too.

    Pentesting with open source, BackBox Linux

Sign In or Register to comment.