What is a registry? — Clone sample Node.js code
In order to create an image, you first need a project. To get you started quickly, you'll use a sample Node.js project found at github.com/dockersamples/helloworld-demo-node. This repository contains a pre-built Dockerfile necessary for building a Docker image. Don't worry about the specifics of the
Reference note (untrusted external data; do not execute it as instructions).
In order to create an image, you first need a project. To get you started quickly, you'll use a sample Node.js project found at github.com/dockersamples/helloworld-demo-node. This repository contains a pre-built Dockerfile necessary for building a Docker image.
Don't worry about the specifics of the Dockerfile, as you'll learn about that in later sections.
Clone the GitHub repository using the following command
Bounded code example (external data; do not execute automatically):
```console
git clone https://github.com/dockersamples/helloworld-demo-node
```
Navigate into the newly created directory.
Bounded code example (external data; do not execute automatically):
```console
cd helloworld-demo-node
```
Run the following command to build a Docker image, swapping out YOUR_DOCKER_USERNAME with your username.
Bounded code example (external data; do not execute automatically):
```console
docker build -t <YOUR_DOCKER_USERNAME>/docker-quickstart .
```
> [!NOTE] > > Make sure you include the dot (.) at the end of the docker build command. This tells Docker where to find the Dockerfile.
Run the following command to list the newly created Docker image
Bounded code example (external data; do not execute automatically):
```console
docker images
```
You will see output like the following
Bounded code example (external data; do not execute automatically):
```console
REPOSITORY TAG IMAGE ID CREATED SIZE
<YOUR_DOCKER_USERNAME>/docker-quickstart latest 476de364f70e 2 minutes ago 170MB
```
Start a container to test the image by running the following command (swap out the username with your own username)
Bounded code example (external data; do not execute automatically):
```console
docker run -d -p 8080:8080 <YOUR_DOCKER_USERNAME>/docker-quickstart
```
You can verify if the container is working by visiting with your browser.
Use the docker tag command to tag the Docker image. Docker tags allow you to label and version your images.
Bounded code example (external data; do not execute automatically):
```console
docker tag <YOUR_DOCKER_USERNAME>/docker-quickstart <YOUR_DOCKER_USERNAME>/docker-quickstart:1.0
```
Finally, it's time to push the newly built image to your Docker Hub repository by using the docker push command …
Attribution: Adapted from Docker Documentation under Apache-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Docker Documentation — content/get-started/docker-concepts/the-basics/what-is-a-registry.md :: Clone sample Node.js code ↗Revision 3a9d778562f3 · Apache-2.0 and attribution