Home Explore Blog CI



docker

2nd chunk of `content/manuals/docker-hub/quickstart.md`
833018dacc07f1b6766b4da62d1192bf4a39c84c307b346d0000000100000fd7
You can run images from Docker Hub using the CLI or Docker Desktop Dashboard.

{{< tabs >}}
{{< tab name="Docker Desktop" >}}

1. In the Docker Desktop Dashboard, select the **nginx** image in the **Docker
   Hub** view. For more details, see [Step 1: Find an image in Docker Hub's
   library](#step-1-find-an-image-in-docker-hubs-library).

2. On the **nginx** screen, select **Run**.

   If the image doesn't exist on your device, it is automatically pulled from
   Docker Hub. Pulling the image may take a few seconds or minutes depending on
   your connection. After the image has been pulled, a window appears in Docker
   Desktop and you can specify run options.

3. In the **Host port** option, specify `8080`.
4. Select **Run**.

   The container logs appear after the container starts.

5. Select the **8080:80** link to open the server, or visit
   [https://localhost:8080](https://localhost:8080) in your web browser.

6. In the Docker Desktop Dashboard, select the **Stop** button to stop the
   container.


{{< /tab >}}
{{< tab name="CLI" >}}

1. Open a terminal window.

   > [!TIP]
   >
   > The Docker Desktop Dashboard contains a built-in terminal. At the bottom of
   > the Dashboard, select **>_ Terminal** to open it.

2. In your terminal, run the following command to pull and run the Nginx image.

   ```console
   $ docker run -p 8080:80 --rm nginx
   ```

   The `docker run` command automatically pulls and runs the image without the
   need to run `docker pull` first. To learn more about the command and its
   options, see the [`docker run` CLI
   reference](../../reference/cli/docker/container/run.md). After running the
   command, you should see output similar to the following.

   ```console {collapse=true}
   Unable to find image 'nginx:latest' locally
   latest: Pulling from library/nginx
   a480a496ba95: Pull complete
   f3ace1b8ce45: Pull complete
   11d6fdd0e8a7: Pull complete
   f1091da6fd5c: Pull complete
   40eea07b53d8: Pull complete
   6476794e50f4: Pull complete
   70850b3ec6b2: Pull complete
   Digest: sha256:28402db69fec7c17e179ea87882667f1e054391138f77ffaf0c3eb388efc3ffb
   Status: Downloaded newer image for nginx:latest
   /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
   /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
   /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
   10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
   10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
   /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
   /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
   /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
   /docker-entrypoint.sh: Configuration complete; ready for start up
   2024/11/07 21:43:41 [notice] 1#1: using the "epoll" event method
   2024/11/07 21:43:41 [notice] 1#1: nginx/1.27.2
   2024/11/07 21:43:41 [notice] 1#1: built by gcc 12.2.0 (Debian 12.2.0-14)
   2024/11/07 21:43:41 [notice] 1#1: OS: Linux 6.10.11-linuxkit
   2024/11/07 21:43:41 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
   2024/11/07 21:43:41 [notice] 1#1: start worker processes
   2024/11/07 21:43:41 [notice] 1#1: start worker process 29
   ...
   ```

3. Visit [https://localhost:8080](https://localhost:8080) to view the default
   Nginx page and verify that the container is running.

4. In the terminal, press <kdb>Ctrl+C</kbd> to stop the container.

{{< /tab >}}
{{< /tabs >}}

You've now run a web server without any set up or configuration. Docker Hub
provides instant access to pre-built, ready-to-use container images, letting you
quickly pull and run applications without needing to install or configure
software manually. With Docker Hub's vast library of images, you can experiment
with and deploy applications effortlessly, boosting productivity and making it

Title: Running Docker Images from Docker Hub: Docker Desktop vs. CLI
Summary
This section details how to run images pulled from Docker Hub using both the Docker Desktop Dashboard and the command-line interface (CLI). For Docker Desktop, it explains how to select the Nginx image, run it, configure port forwarding, and access the server in a web browser. For the CLI, it provides the command to pull and run the Nginx image, access the server, and stop the container. It emphasizes Docker Hub's role in providing instant access to pre-built container images, facilitating quick application deployment.