> For the complete documentation index, see [llms.txt](https://burkeholland.gitbook.io/vs-code-can-do-that/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://burkeholland.gitbook.io/vs-code-can-do-that/exercise-5-docker/running-and-inspecting-images.md).

# 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 %}
