• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to build Docker Images using Docker File on Debian 11.3

  • 00:28 lsb_release -a
  • 00:37 apt list --installed | grep docker
  • 00:56 docker -v
  • 01:07 mkdir dockerfiles
  • 01:22 nano dockerfiles/dockerfile
  • 02:54 docker build dockerfiles
  • 03:21 docker images
  • 03:30 docker run 299f66779d73
{{postValue.id}}

To Build Docker Images Using Docker File on Debian 11.3.

Introduction:

A Docker image is a file used to execute code in a Docker container. Docker images act as a set of instructions to build a Docker container, like a template. Docker images also act as the starting point when using Docker.

Procedure:

Step 1: Check the OS version by using the below Command

root@linuxhelp: ~# lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye

Step 2: To verify the Docker image install by using the below command

root@linuxhelp:~# apt list --installed | grep docker

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

docker-ce-cli/bullseye,now 5:20.10.17~3-0~debian-bullseye amd64 [installed]
docker-ce-rootless-extras/bullseye, now 5:20.10.17~3-0~debian-bullseye amd64 [installed,automatic]
docker-ce/bullseye,now 5:20.10.17~3-0~debian-bullseye amd64 [installed]
docker-scan-plugin/bullseye, now 0.17.0~debian-bullseye amd64 [installed,automatic]

Step 3: Check the Docker Version by using the below command

root@linuxhelp: ~# docker -v 
Docker version 20.10.17, build 100c701

Step 4: Next create a folder, named docker files by using the below command

root@linuxhelp: ~# mkdir dockerfiles

Step 5: Make a new file name docker files inside the docker folder by using the below command

root@linuxhelp: ~# nano dockerfiles/dockerfile
#Getting Image from docker hub
From httpd
RUN apt-get update
CMD [“echo”, “Apache Web Server Image”]

Step 6: Next build the file and give the location of Docker file by using the below command

root@linuxhelp: ~# docker build dockerfiles
Sending build context to Docker daemon  2.048kB
Step 1/3 : From httpd
latest: Pulling from library/httpd
1efc276f4ff9: Pull complete
aed046121ed8: Pull complete
4340e7be3d7f: Pull complete
80e368ef21fc: Pull complete
80cb79a80bbe: Pull complete
Digest: sha256:343452ec820a5d59eb3ab9aaa6201d193f91c3354f8c4f29705796d9353d4cc6
Status: Downloaded newer image for httpd: latest
 ---> f2a976f932ec
Step 2/3 : Run apt-get update
 ---> Running in 3d2e57e3330b
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:2 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:4 http://deb.debian.org/debian bullseye/main amd64 Packages [8182 kB]
Get:5 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [170 kB]
Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [2592 B]
Fetched 8563 kB in 1s (5837 kB/s)
Reading package lists...
Removing intermediate container 3d2e57e3330b
 ---> c14b20874022
Step 3/3 : CMD ["echo", "Apache webserver image"]
 ---> Running in 4890f5ed1eee
Removing intermediate container 4890f5ed1eee
 ---> 299f66779d73
Successfully built 299f66779d73

Step 7: List the docker images by using the below command

root@linuxhelp: ~# docker images
REPOSITORY    TAG       IMAGE ID       CREATED          SIZE
<none>        <none>    299f66779d73   25 seconds ago   163MB
<none>        <none>    f645b68f51bb   32 minutes ago   142MB
httpd         latest    f2a976f932ec   4 days ago       145MB
debian        latest    07d9246c53a6   4 days ago       124MB
hello-world   latest    feb5d9fea6a5   10 months ago    13.3kB

Step 8: Run the docker images by using the below command

root@linuxhelp: ~# docker run 299f66779d73
Apache Web Server Image

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to Build Docker Images using Docker Files on Debian 11.3. Your feedback is much welcome.

Tags:
kishore
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What is Dockerfile used for?

A

A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image. Using docker build users can create an automated build that executes several command-line instructions in succession. This page describes the commands you can use in a Dockerfile.

Q

What is a docker image vs container?

A

Docker images describe the applications and how they can be run. Docker containers are the image instances, where multiple containers of the same image can be run, each in a different state.

Q

How do I view an image in docker?

A

To analyze a Docker image, simply run dive command with Docker "Image ID". You can get your Docker images' IDs using "sudo docker images" command. Here, ea4c82dcd15a is Docker image id. The Dive command will quickly analyze the given Docker image and display its contents in the Terminal.

Q

What is extension of Dockerfile?

A

A Dockerfile must be created with no extension. To do this in Windows, create the file with your editor of choice, then save it with the notation "Dockerfile" (including the quotes).

Q

What is a container image?

A

A container image is an unchangeable, static file that includes executable code so it can run an isolated process on information technology (IT) infrastructure.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help keel johnston ?
Unhide the folders on windows Explorer

Give any solutions to unhide folder using command prompt?

forum3

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.