Ismayil S
Ismayil S

Reputation: 243

Can't create docker file and Project file using Docker

I need to create an Azure function project via Docker. I learned something about the docker commands for creating the function app project and templates.

I already installed the docker and related SDKs in my system.

I used this command for create function with docker file "func init . --docker" but it'd not working properly, enter image description here

enter image description here This is the files created without the docker file, I don't know why it's not create.

After that I execute the "func new" command for creating the function with language and Function Templates also selected,

enter image description here

enter image description here

And also not create the project(*.csproj) file. I executed the commands properly but why it's not coming I don't know about it. Please give me a solution for this. Thank you.

Upvotes: 2

Views: 445

Answers (1)

Baklap4
Baklap4

Reputation: 4202

I've got this up and running in WSL As stated in the readme one should make sure everything is set up correctly.

  1. Start up WSL
  2. run wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
    • This will download a file needed to install azure functions correctly.
  3. run sudo dpkg -i packages-microsoft-prod.deb to install the previously downloaded package.
  4. run sudo apt-get update to update your local aptitude cache.
  5. run sudo apt-get install azure-functions-core-tools to install the azure functions core tools.
  6. Make sure dotnet is installed: run sudo apt-get install dotnet-sdk-2.2
  7. Run func init . --docker and select dotnet as framework (option 1)

This will result into a list of files in your current directory:

.
├── Dockerfile
├── host.json
├── local.settings.json
└── test.csproj

0 directories, 4 files

You can now create an Azure function by running func new. Select a template (HttpTrigger, option 2), provide a name SampleFunction and you have your function ready.

Your directory now looks like this:

.
├── Dockerfile
├── SampleFunction.cs
├── host.json
├── local.settings.json
└── test.csproj

0 directories, 5 files

This is all done with func version 2.3.199

Upvotes: 1

Related Questions