-
Notifications
You must be signed in to change notification settings - Fork 2
/
deployfile.yml
39 lines (34 loc) · 1 KB
/
deployfile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
- hosts: java-servers
become: true
tasks:
- name: Adding Docker repository
yum_repository:
name: Docker
description: Docker Repo
baseurl: https://download.docker.com/linux/centos/7/x86_64/stable
gpgcheck: no
- name: Installing Docker package
package:
name: "docker-ce-18.09.1-3.el7.x86_64"
state: present
- name: Starting docker service
service:
name: "docker"
state: started
enabled: yes
- name: Installing Docker SDK for python3
command: pip3 install docker
- name: stop container
command: docker stop first-image
ignore_errors: yes
- name: remove container
command: docker rm first-image
ignore_errors: yes
- name: remove image
command: docker rmi raghu133/first-image
ignore_errors: yes
- name: pulling image from dockerhub
command: docker pull raghu133/first-image:0.0.1
- name: building docker container image and expose
command: docker run -d -p 8080:8080 raghu133/first-image:0.0.1