Anupama H
@anuhosad
@anuhosad
@anuhosad
@anuhosad
@anuhosad
When the QA person finds a bug
Well, it works on my machine ;-P
@anuhosad
From wikipedia:
Docker is a set of platform-as-a-service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. "
@anuhosad
@anuhosad
APP
Dockerfile
Container
Container
Container
Build
Run
@anuhosad
Dockerfile
Container
Set of instructions on how to build the image. Define the images to include, commands to run etc.
Similar to an exe file, contains the executable app
Instance of an image. The app is running inside the container.
@anuhosad
Container
APP
ENV Variables
Libraries
p
o
r
t
@anuhosad
Define a Dockerfile at the root of your project folder
@anuhosad
Define each image that you want to be included along with its version
FROM node:10.6.0
Pulls packages from Docker hub
@anuhosad
Add any required environment variables which will be available inside the container
ENV BASEDIR /opt/unbxd/pimento-ui
ARG ASSETS_AWS_KEY_ID
ARG ASSETS_AWS_SECRET_KEY
ENV ASSETS_AWS_KEY_ID ${ASSETS_AWS_KEY_ID}
ENV ASSETS_AWS_SECRET_KEY ${ASSETS_AWS_SECRET_KEY}
@anuhosad
Specify the commands to run when the image is being created
# Install npm dependecies
RUN npm install --verbose
# Install grunt
RUN npm install -g grunt
# run the release task
RUN NODE_ENV=production grunt release
@anuhosad
Expose the port on which you can access the application running inside docker
# Make port 8090 available
# to the world outside this container
EXPOSE 8090
@anuhosad
Specify the commands to run when the container is launched
# Run app.js when the container launches
CMD ["sh", "-c", "NODE_ENV=production node app.js"]
@anuhosad
Download docker app for mac / windows: https://www.docker.com/get-started
Start the docker daemon
@anuhosad
docker build -t <appname> .
Run the below command inside the app directory where the Dockerfile is created
Check that image has been created by running following command
docker image ls
@anuhosad
docker run -d -p 3000:8090 <appname>
Run the docker image using the following command
-d => runs the docker image in the background
-p => maps host port 3000 to container port 8090, so that you can access the docker application at localhost:3000/
docker ps
List docker containers
@anuhosad
docker exec -it <container ID> bash
Enter into the docker container
docker rmi <image ID>
Remove docker image
docker rm -f <container ID>
Remove docker container
@anuhosad
@anuhosad
Service X
Dockerfile
Container
Build
Run
Web App
Dockerfile
Dockerfile
Service Y
Build
Build
Container
Run
Container
Run
D
o
c
k
e
r
H
u
b
S
E
R
V
E
R
S
Versioned images for easier rollback
@anuhosad
@anuhosad