Giter Club home page Giter Club logo

install-docker-ansible's Introduction

Install docker with Ansible

Docker is one of the most famous and practical tools. You need to install it on any server you connect to. With this playbook, you can install Docker in Ubuntu hosts and grant non-root access to yourself or other users.

Please note that this playbook actually reinstalls your Docker engine if it was already installed. It removes all unofficial packages, but it does not delete your images, containers, volumes, or networks.

Instructions

  1. Clone this repository.
git clone https://github.com/rastinsenobari/install-docker-ansible && cd install-docker-ansible
  1. Run the Ansible playbook.
ansible-playbook install-docker.yml -K

After executing the command, you need to enter a password to access "sudo" in order to apply changes to the system.

Options

  • By default, this playbook grants the running user non-root access to execute Docker commands. If you wish to ignore this default behavior, you should run it like this:
ansible-playbook install-docker.yml -K --extra-vars "running_user_access='false'" 
  • If you want to grant non-root access to other users, you should add the users in the template and run the playbook like this:
ansible-playbook install-docker.yml -K --extra-vars "add_users_access='true'" 
users:
  - user1
  - user2

change users.yml like this template

Verification

Run the following command to check the installation:

docker run hello-world

Note: If you encounter 'permission denied' due to lack of access, you should log out and log in again. Alternatively, you can use the following command.

su - $USER

Pay attention: If the command does not run correctly, it's possible that you don't have access to Docker Hub. In such cases, consider using a Docker-registry-mirror or configuring DNS to pull images.

Contributing

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue. Don't forget to give the project a star! Thanks again!

install-docker-ansible's People

Contributors

rastinsenobari avatar

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.