# Running and inspecting images

You can run any image in a container from within VS Code. VS Code also provides functionality for inspecting, managing and otherwise working with images and containers on your machine.

{% tabs %}
{% tab title="Exercise" %}

* Run the "i-love-lamp:latest" image from the Docker Explorer in VS Code
* View the application running on port 3000
* View the image logs
* Attach a shell to the running image and inspect the file system
* Stop the image
* Remove the image
  {% endtab %}

{% tab title="Answer" %}

* Open the Docker Explorer view by clicking on the Docker icon in the Activity Bar

![](/files/-Lm5n67h5J90i-IfAMfR)

* In the "images" section, locate the "i-love-lamp" image. Expand it to find the "latest" image.

![](/files/-Lm5nJHqB-NEGqlaIRdK)

* Right-click the image and select "Run"
* Notice that there is now a container running

![](/files/-Lm5n_OjTR1JNGt7ZhNM)

* Open your browser and navigate to "<http://localhost:3000>"
* View the application running in the Docker container

![](/files/-Lm5pef2Lg5kARO2_TA6)

* Right click the container in the "Containers" section of the Docker Explorer view and select "View Logs"
* View the logs from the container

![](/files/-Lm5puLfPyzITdY5Im01)

* Right click the container in the "Containers" section of the Docker Explorer view and select "Attach Shell"
* The integrated terminal will open connected to the Docker container
* Navigate the file system with `cd` to change directory and `ls` to list the file system contents

![](/files/-Lm5qEfXzrEwomfnKtkv)

{% hint style="info" %}
Note that if you navigate to "/" with `cd /`, you will get to the root of the container. Notice how it appears as if the container is an entire Linux machine with a complete file system.
{% endhint %}

* Right click the container in the "Containers" section of the Docker Explorer view and select "Stop"
* Right click the container in the "Containers" section of the Docker Explorer view and select "Remove"
* The container will be removed from the "Containers" section in VS Code
  {% endtab %}
  {% endtabs %}


---

# 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://burkeholland.gitbook.io/vs-code-can-do-that/exercise-5-docker/running-and-inspecting-images.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.
