Skip to main content

Posts

Showing posts with the label Docker

Install Docker on Ubuntu localhost using Ansible Playbook

Install Docker on Ubuntu localhost using Ansible Playbook --- - hosts: localhost tasks: - name: Update all packages to the latest version apt: name: "*" state: latest when: ansible_facts['os_family'] == "Debian" become: true - name: Upgrade all packages to the latest version apt: upgrade: dist when: ansible_facts['os_family'] == "Debian" become: true - name: Install apt-transport-https package: name: apt-transport-https state: present when: ansible_facts['os_family'] == "Debian" become: true - name: Install ca-certificates package: name: ca-certificates state: present when: ansible_facts['os_family'] == "Debian" become: true - name: Install curl package: ...

Docker in Brief

Docker Hub Registry Docker is a platform for developers and sysadmins to build, run, and share applications with containers. The use of containers to deploy applications is called containerization. Containerization is increasingly popular because containers are: Flexible: Even the most complex applications can be containerized. Lightweight: Containers leverage and share the host kernel, making them much more efficient in terms of system resources than virtual machines. Portable: You can build locally, deploy to the cloud, and run anywhere. Loosely coupled: Containers are highly self sufficient and encapsulated, allowing you to replace or upgrade one without disrupting others. Scalable: You can increase and automatically distribute container replicas across a datacenter. Secure: Container...

Install Spinnaker as a Docker Container on Ubuntu using Ansible Playbook

Install Spinnaker as a Docker Container on Ubuntu using Ansible Playbook --- - hosts: localhost vars: environment: PYTHONPATH: "{{ lookup('env','PYTHONPATH') }}:/usr/local/lib/python2.7/dist-packages:/usr/local/lib/python2.7/site-packages" tasks: - name: Update all packages to the latest version apt: name: "*" state: latest when: ansible_facts['os_family'] == "Debian" become: true - name: Upgrade all packages to the latest version apt: upgrade: dist when: ansible_facts['os_family'] == "Debian" become: true - name: Install python2 pip package: name: python-pip when: ansible_facts['os_family'] == "Debian" become: true - name: Install python-requests module apt: name: python-requests...

Docker Commands

Docker Hub Registry sudo docker login - To login into default docker registry https://hub.docker.com/ sudo docker login registryURL - To login into private registry sudo docker push repoName/imageName:tag - Push image to registry in given repoName=respository name, as imageName with tag=ex. 1.0.0 sudo docker pull repoName/imageName:tag - Pulgl docker image sudo docker tag existingRepoName/imageName:tag newRepoName/imageName:tag - Create new tagged image Interacting with Container sudo docker run -it imageName – -i means interactive, -t means provide terminal sudo docker run -d imageName - -d means run in background mode sudo docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|- sudo docker cp [OPTIO...

Docker Networks

Docker Networks One of the reasons Docker containers and services are so powerful is that you can connect them together, or connect them to non-Docker workloads. Docker’s networking subsystem is pluggable, using drivers. Several drivers exist by default, and provide core networking functionality: Bridge: The default network driver. If you don’t specify a driver, this is the type of network you are creating. Bridge networks are usually used when your applications run in standalone containers that need to communicate. Host: For standalone containers, remove network isolation between the container and the Docker host, and use the host’s networking directly. host is only available for swarm services on Docker 17.06 and higher. See use the host network. Overlay: Overlay networks connect multiple Docker...