0% found this document useful (0 votes)
5 views2 pages

Code 7 Dsasiauto

The document outlines a series of Docker commands to manage containers and build a Node.js application. It includes instructions for creating a Dockerfile and package.json, building an image, tagging it, and pushing it to a Docker repository. The process demonstrates setting up a simple Node.js app with Express and managing it using Docker commands.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Code 7 Dsasiauto

The document outlines a series of Docker commands to manage containers and build a Node.js application. It includes instructions for creating a Dockerfile and package.json, building an image, tagging it, and pushing it to a Docker repository. The process demonstrates setting up a simple Node.js app with Express and managing it using Docker commands.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

keep docker on

docker ps
docker run hello-world
docker run -d --name my-nginx nginx
docker stop my-nginx
docker start my-nginx
docker stop my-nginx
docker image ls

create file

file name - Dockerfile

# Use official Node.js image


FROM node:18-alpine

# Set working directory inside container


WORKDIR /app

# Copy package.json and install dependencies


COPY package.json ./
RUN npm install

# Copy the rest of the app


COPY . .

# Expose port
EXPOSE 3000

# Command to run the app


CMD ["npm", "start"]

create package.json

{
"name": "my-app",
"version": "1.0.0",
"scripts": {
"start": "node app.js"
},
"dependencies": {
"express": "^4.17.1"
}
}

docker build -t myimage .


docker tag myimage geethika138/myimage - use your docker username
docker push geethika138/myimage

Using default tag: latest


The push refers to repository [docker.io/geethika138/myimage]
02c8d76d3e72: Already exists
f46e519824fb: Layer already exists
f4ad39b9f44a: Layer already exists
a5cf150cb374: Layer already exists
41a56989bc49: Layer already exists
f18232174bc9: Layer already exists
ddd517c79a18: Layer already exists
06aedaccc028: Layer already exists
3d8c59f7308d: Layer already exists
latest: digest:
sha256:0858e2c7460a3887288f9d50fac80d4009715f1021c840a72bc2820edde8e679 size: 856

You might also like