# Docker Hub

Sharing Docker images is made easy by Docker Hub. Anybody can create an account to Docker Hub to distribute images that can be deployed on other systems or by other users.&#x20;

For this example, let us use an open source project from github. The TodoMVC using Nodejs, Vue, and Nuxt should be a great example. It is a demo application using JavaScript on the server and client.&#x20;

{% embed url="<https://github.com/nuxt/todomvc>" %}

Lets clone the project so that we have it on our computer. Cloning the git repository can be done with the following command:&#x20;

```
git clone https://github.com/nuxt/todomvc.git
```

This will download the project in a directory called `todomvc`.

By default the project does not provide a Dockerfile. We will need to create one. An example could be:

{% embed url="<https://gist.github.com/sillevl/09be59e875c706296cbfd01d627bc95e>" %}

This `Dockerfile` will use a node image to provide the JavaScript runtime on the server. It will also install all dependencies using the npm package manager. Finally it will start the application using the `npm start` command.

Lets build it using the command

```
docker build -t todomvc .
```

You can test the container using the command

```
docker run -it -p 80:3000 todomvc
```

When everything works well, you could share the image using Docker Hub. You will need to create an account to be able to push (upload) an image and distribute it to other systems or developers.

When you have an account, you can log in to Docker Hub using the command

```
docker login
```

Before we can push the container we need to 'tag' it with a name. This can be done using the command

```
docker tag todomvc YOUR-USER-ID/todomvc
```

{% hint style="info" %}
Don't forget to replace YOUR-USER-ID with your Docker Hub user id.
{% endhint %}

Now you are ready to push the image to Docker Hub using the command

```
docker push YOUR-USER-ID/todomvc
```

You can now go to your Docker Hub and see your newly pushed image at <https://hub.docker.com/>

The image is now available to anybody and a container be created from it and run using the command

```
docker run -it -p 80:3000 YOUR-USER-ID/todomvc
```

You should now be able to visit the webpage at <http://192.168.99.100>

![](https://3155969731-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAse2WvJYHuIEXpYSUk%2F-LB2VHNZgH_ufTNHpUDO%2F-LB2VK2E9ufywa9_x5ud%2Ftodomvc.png?alt=media\&token=0d08f646-5224-464e-8a81-8c9df810c153)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://vives.gitbook.io/docker/docker-hub-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
