Hello, Am Udhay (OO-dhy)
A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another.
A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.
#Download Node Alpine image FROM node:12.16.1-alpine As build #Setup the working directory WORKDIR /usr/src/ng-app #Copy package.json COPY package.json package-lock.json ./ #Install dependencies RUN npm install #Copy other files and folder to working directory COPY . . #Build Angular application in PROD mode RUN npm run build #Download NGINX Image FROM nginx:1.15.8-alpine #Copy built angular files to NGINX HTML folder COPY --from=build /usr/src/ng-app/dist/pokemon-app/ /usr/share/nginx/html
Execute below command to build Docker container image for our Angular application.
docker build -t poke .
Execute below command to start the docker container to run the application.
docker run -dp 3000:80 poke
Okay it's time to push the image we created to Docker Hub.
To push an image, we first need to create a repo on Docker Hub.
1. Go to Docker Hub - https://hub.docker.com/ and log in if you need to.
2. Click the Create Repository button.
3. For the repo name, use getting-started. Make sure the Visibility is Public.
4. Click the Create button!
Execute below commands one by one to push docker image to Docker Hub. Make sure you update
# Create Image matching your Repo using TAG command docker tag poke:latest [DOCKER-ACCOUNT-NAME]/poke:latest # PUsh the image to Docker Hub docker push [DOCKER-ACCOUNT-NAME]/poke:latest
Step 1: Login to "Play with Docker" - https://labs.play-with-docker.com/ (You need to have Docker account. Signup!)
Step 2: Click on "Start"
Step 3: Click on "Add new instance" to launch New instance
Step 4: Run below command in the Web terminal.
docker run -dp 3000:80 askudhay/poke
Step 5: The above command pulls the Pokemon App Docker image and serve it on Port 3000
Step 6: Click on "3000" link appears next to "Open Port" button.