forked from vikas99341/node-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
79 lines (62 loc) · 2.12 KB
/
dockerfile
File metadata and controls
79 lines (62 loc) · 2.12 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Docker file is a blueprint for building image
Keywords:
FROM: Talks about the base image
ENV : Optional as environment variables are defined here .
RUN : Execute any Linux command .Execution will happen inside the container .
COPY: Source can be local, and destination is inside container
CMD – Always part of docker file . Execute entry point Linux command .
Multiple RUN commands can be there but only one CMD command .
===========
FROM ubuntu
Maintainer "Vikas"
RUN apt-get update
RUN apt-get install vim -y
CMD /bin/echo "Hello from Docker"
===========
nano dockerfile
docker build -t <docker-hub-id>/ubuntu-morning:v1 .
docker images
docker run -d --name custom-docker <docker-hub-id>/ubuntu-morning:v1
docker ps -a
docker login
provide username & password
docker push <docker-hub-id>/ubuntu-morning:v1
check on hub.docker.com
====================================
FROM nginx:latest
RUN apt -y update
RUN apt install -y git
RUN apt install -y apache2
COPY ./index.html /usr/share/nginx/html/index.html
CMD ["nginx", "-g", "daemon off;"]
=========================================================================
nano dockerfile
docker build -t ********/nginx-custom-image:1.0 .
docker images
docker run -d ********/nginx-custom-image:1.0
docker ps -a
docker login - provide your credentials
docker push ***********/nginx-custom-image:1.0
Check on hub.docker.com
clean everything from your loacl and create new stuffs
docker pull *********/nginx-custom-image:1.0
and continue as normal
to go inside the container:
docker exec -it <container-id> /bin/bash
example : docker exec -it e316f75cad14 /bin/bash
to see the property of container
example : docker inspect e316f75cad14
to check the logs
example : docker logs -f <keyword>
to start and stop the container
example : docker start <container-id>
example : docker stop <container-id>
=================================================
FROM nginx:latest
RUN apt -y update
RUN apt install -y git
RUN apt install -y apache2
COPY ./index.html /usr/share/nginx/html/index.html
VOLUME /app
CMD ["nginx", "-g", "daemon off;"]
======================================================