Skip to content

Docker Build and Publish to Dockerhub and Nexus Repository

Notifications You must be signed in to change notification settings

sagarkpanda/fakeweb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build a docker image and push to Docker Hub/Nexus Repositoy

NGINX


Read the whole Article here:

Docker hub:

Nexus:

- Build the Image

  • To build the image, we need to run the docker build command: docker build -t <name:tag> . 

docker build -t fbweb:1.0 .

  • After Entering this command, we shall see a updates like these:
[+] Building 22.3s (6/8)                                                                                                         
 => [internal] load .dockerignore                                                                                           0.0s
 => => transferring context: 2B                                                                                             0.0s
 => [internal] load build definition from Dockerfile                                                                        0.0s
 => => transferring dockerfile: 205B                                                                                        0.0s
 => [internal] load metadata for docker.io/library/ubuntu:22.10                                                             4.1s
 => [1/4] FROM docker.io/library/ubuntu:22.10@sha256:a82eebb42083a134e009a6b81a7e5d2eecc37112fa8ae40642bd3c5153b7e4f0       2.3s
 => => resolve docker.io/library/ubuntu:22.10@sha256:a82eebb42083a134e009a6b81a7e5d2eecc37112fa8ae40642bd3c5153b7e4f0       0.0s
 => => sha256:a82eebb42083a134e009a6b81a7e5d2eecc37112fa8ae40642bd3c5153b7e4f0 1.13kB / 1.13kB                              0.0s
 => => sha256:8c8f22bacbfba9678edddcc3b6d1e56cce02eff9cbf27ab46116de30cb79a3d6 424B / 424B                                  0.0s
 => => sha256:558d44db75c8f69c29f427cf88e6a71c39320f7607584baa6860f6e4f6121892 2.30kB / 2.30kB                              0.0s
 => => sha256:5c19388d38e1ea904672812dd0aac505220c9254e2621a1684e0fe29e2dba80e 26.70MB / 26.70MB                            1.7s
 => => extracting sha256:5c19388d38e1ea904672812dd0aac505220c9254e2621a1684e0fe29e2dba80e                                   0.5s
 => [internal] load build context                                                                                           0.0s
 => => transferring context: 76.93kB                                                                                        0.0s
 => [2/4] RUN apt update -y                                                                                                11.7s
 => [3/4] RUN apt install lighttpd -y                                                                                       4.2s 
 => => # 0 upgraded, 14 newly installed
 
  • If there are no errors, this will will be completed with this kind of message:
=> exporting to image                                                                                                      0.3s 
 => => exporting layers                                                                                                     0.3s 
 => => writing image sha256:9443bff58bb37cea0eec454cb7628f1ab6de13328f7533d9d55772df77b691d6                                0.0s 
 => => naming to docker.io/library/fbweb:1.0                                                                                0.0s 

To view the list of Images we can use : docker images command.

└──| docker images
REPOSITORY   TAG       IMAGE ID       CREATED        SIZE
fbweb        1.0       bcb23d33bf82   1 minutes ago   163MB 

- Running the application:

  • Now lets run this image with the following command:
──| docker run --name fb -td -p 80:80 fbweb:1.0 
551eddaa8434ac7665e85bf7e959493eb21783ad4f332fdcc5b678e5769ae233

──| docker ps
CONTAINER ID   IMAGE       COMMAND                  CREATED         STATUS         PORTS                               NAMES
551eddaa8434   fbweb:1.0   "/bin/sh -c 'service…"   6 seconds ago   Up 6 seconds   0.0.0.0:80->80/tcp, :::80->80/tcp   fb

  • Lets Browse our application:

Screenshot-2023041514_1

About

Docker Build and Publish to Dockerhub and Nexus Repository

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published