# Create a remote container

In this exercise, you'll create a container in which to run the Lamp API in an Azure Functions project locally. Azure Functions requires a specific setup in order to work, including .NET Core, Azure Functions Core Tools and the Azure Functions extension. All of these things will be isolated in the container.

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

* Add the Remote Development configuration files to the "start" project
* Include all of the dependencies to run an Azure Functions project
* Open the project in the container
* Run the API as a Serverless Function
  {% endtab %}

{% tab title="Answer" %}

* Open the Command Palette(**Cmd/Ctrl + Shift + P**)
* Select "Remote-Containers: Add Development Container Configuration Files"

![](https://1151923643-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LlvtEHKkq5bvzPq1pJ4%2F-Lm6AhaqaDVJeCJlRoB-%2F-Lm6EnKCE5u3pkZt_WeL%2Fimage.png?alt=media\&token=fcbf9e44-0be1-4618-900a-2dadfcd1549d)

Select the "start" project from the prompt

![](https://1151923643-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LlvtEHKkq5bvzPq1pJ4%2F-Lm6AhaqaDVJeCJlRoB-%2F-Lm6F-jABdZZCaLvX0AY%2Fimage.png?alt=media\&token=ebbdf5b5-da30-4ec6-8bd1-bf9f38b1a133)

* Select the "Azure Functions & Node.js (latest LTS)

![](https://1151923643-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LlvtEHKkq5bvzPq1pJ4%2F-Lm6AhaqaDVJeCJlRoB-%2F-Lm6J2NEUhNem6OKpCav%2Fimage.png?alt=media\&token=0ac368e8-7a1a-41b1-8951-67861653b6fa)

* VS Code will add a ".devcontainer" folder to the "start" project. Inside this folder are two files..
  * Dockerfile
  * devcontainer.json
* Open the Command Palette (**Cmd/Ctrl + Shift + P**)
* Select "Remote-Containers: Open Folder in Container"

![](https://1151923643-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LlvtEHKkq5bvzPq1pJ4%2F-Lm6AhaqaDVJeCJlRoB-%2F-Lm6GkiP_VLRHXo-I5Zi%2Fimage.png?alt=media\&token=abd527d9-e3c8-4655-9fc5-b146dbefb2ca)

* Find the "start" folder inside the "exercise-6-remote-containers" folder and select it

![](https://1151923643-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LlvtEHKkq5bvzPq1pJ4%2F-Lm6AhaqaDVJeCJlRoB-%2F-Lm6HEeo1zxLaUETXhap%2Fimage.png?alt=media\&token=ed2d4260-bb95-4a30-bcd1-12ca681dc8de)

* VS Code will immediately begin to build a container. You will see that in the bottom panel.&#x20;

![](https://1151923643-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LlvtEHKkq5bvzPq1pJ4%2F-Lm6AhaqaDVJeCJlRoB-%2F-Lm6IcCIhtwTJjylUA9h%2Fimage.png?alt=media\&token=33df1e60-8b05-4186-a836-659bade7fae0)

* Once the container is built, VS Code will be connected to the project which is now running inside of a container

![](https://1151923643-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LlvtEHKkq5bvzPq1pJ4%2F-Lm6AhaqaDVJeCJlRoB-%2F-Lm6HykC5MJiieWtFrDQ%2Fimage.png?alt=media\&token=bc761150-6ecc-4afe-bb98-788dedb052a4)

* Press **F5** to start the Serverless Function project

![](https://1151923643-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LlvtEHKkq5bvzPq1pJ4%2F-Lm6AhaqaDVJeCJlRoB-%2F-Lm6KBbbvrFWiW67QuDn%2Fimage.png?alt=media\&token=5718efa2-0e7a-48d1-81bb-d5773a48b78d)

* Browse to "localhost:7071/api/setColor" on your machine
  * Pass a query string variable "localhost:7071/api/setColor?color=blue"
* You will receive a response from the Serverless Function

![](https://1151923643-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LlvtEHKkq5bvzPq1pJ4%2F-Lm6AhaqaDVJeCJlRoB-%2F-Lm6KckHI7LBxVzaP_ld%2Fimage.png?alt=media\&token=4d3daf8a-8424-4667-8567-20f25c913468)

{% endtab %}
{% endtabs %}
