Home Explore Blog CI



docker

4th chunk of `content/manuals/docker-hub/quickstart.md`
74fe885aa5e6e2ee44c88d8957b8988e41eb08d44eaaa2d20000000100000832
   command, you should see output similar to the following.

   ```console {collapse=true}
   [+] Building 0.6s (6/6) FINISHED                      docker:desktop-linux
    => [internal] load build definition from Dockerfile                  0.0s
    => => transferring dockerfile: 128B                                  0.0s
    => [internal] load metadata for docker.io/library/nginx:latest       0.0s
    => [internal] load .dockerignore                                     0.0s
    => => transferring context: 2B                                       0.0s
    => [1/2] FROM docker.io/library/nginx:latest                         0.1s
    => [2/2] RUN echo "<h1>Hello world from Docker!</h1>" > /usr/share/  0.2s
    => exporting to image                                                0.1s
    => => exporting layers                                               0.0s
    => => writing image sha256:f85ab68f4987847713e87a95c39009a5c9f4ad78  0.0s
    => => naming to docker.io/mobyismyname/nginx-custom                  0.0s
   ```

3. Run the following command to test your image. Replace `<YOUR-USERNAME>` with
   your Docker ID.

   ```console
   $ docker run -p 8080:80 --rm <YOUR-USERNAME>/nginx-custom
   ```

4. Visit [https://localhost:8080](https://localhost:8080) to view the page. You
   should see `Hello world from Docker!`.

5. In the terminal, press CTRL+C to stop the container.

6. Sign in to Docker Desktop. You must be signed in before pushing an image to
   Docker Hub.

7. Run the following command to push your image to Docker Hub. Replace `<YOUR-USERNAME>` with your Docker ID.

   ```console
   $ docker push <YOUR-USERNAME>/nginx-custom
   ```

    > [!NOTE]
    >
    > You must be signed in to Docker Hub through Docker Desktop or the command line, and you must also name your images correctly, as per the above steps.

   The command pushes the image to Docker Hub and automatically
   creates the repository if it doesn't exist. To learn more about the command,
   see the [`docker push` CLI
   reference](../../reference/cli/docker/image/push.md). After running the

Title: Testing and Pushing the Custom Nginx Image to Docker Hub
Summary
After building the image, the instructions guide the user on how to test the image by running it and verifying the custom content. It emphasizes the importance of being signed in to Docker Desktop before pushing the image to Docker Hub. The user is instructed to push their image using the `docker push` command, which automatically creates the repository if it doesn't already exist. A note highlights the need for correct naming conventions and authentication for successful pushing.