I officially joined the ScreenCloud team in June 2018 as a Developer working remotely for the Marketing Team. As a distributed company, ScreenCloud’s team members are located all over the world: some…
You may have heard talk about Docker, but not about Azure Functions. Anyway, let me tell you how they can help you to only worry about coding (best part, isn’t it?).
Don’t worry about requisites, I’ll keep this step-by-step guide very simple. I’ll only supose that you are a Window’s user and have basic knowledge on c#.
It’s a nice blue whale, it handles images and containers for us. But wait, I have already mentioned two of the most important concepts about Docker, but I still have to tell you a bit more.
Containers are the way Docker handles those images. Containers are running instances of images. To keep it simple, we can say that they are to images what exe file is to source code. You can have several containers of the same image. You can also stop and re-run them -you have to be careful about not to have lots of containers running when you are modifying your image.
If you haven’t ever heard about Azure, the only thing that you need to know is that Azure is Microsoft’s cloud solution for almost everything. It has hundreads of features, and they are releasing new ones all the time.
Today, we are going to focus on Azure Functions.
It allows you to write serverless pieces of code to run on-demand. You tell Functions “please, run this code when someone hit that endpoint”, and Functions will manage the rest for us. You can use several triggers, we’ll see them later.
All right, it’s time to open a terminal and let’s make it work.
First of all, let’s check that everything is working fine. Type
If it shows npm’s version, then you are ok to move on.
Then run
To use Azure Functions locally, we first need to install it. We use npm for that, with install
command. With -g
we tell npm to install it globally, not only in the current folder/project. azure-functions-core-tools
is the package name.
Once it has been downloaded and installed, we must check if Docker is running. Next, run
and it’ll tell what Docker version we have installed.
All right, we -finally- have all we need. Let’s use Funtions. Run
to check if package has been correctly installed.
Let’s use Functions. Create a folder and move to it. After that, type:
and choose dotnet
runtime. You can also use python or node, but in this tutorial we’ll use dotnet.
Now, we have created a project with all the files Docker needs to work (that’s what --docker
parameter is for).
Now, we must create a new Function. Type
Now, go to the folder where you have created the project. You’ll see something like that:
Once you have changed it, our Function is ready to start working.
We said that we need to make an image first, and this is what
First, check if image is correctly built. Run
You’ll see your image
Now, let’s run it with -p
to set port to run at.
Now, we have created a container based on the image that we had created before. It’s now running, you can check this opening a browser and going to http://localhost:8080/
Our container is running ok, but is our Azure Function working? Let’s find out.
If you see
so it’s all working!
We can check Docker container by running
Keep in mind that if you want to modify your Function, you need to:
We have seen how to use Azure Functions with Docker, it’s very easy as you can see. You don’t need to use them together, Docker and Functions are very powerful by their own. I have a living example on Azure, contact me to get the code to test it.
Thanks for reading! 🤗
An immersive musical experience for the hard of hearing and deaf community. Written by: Devina Parihar, Jill Rosow, Shih-Tsai Wei, Ryo Moriyama, and Santiago Garza.
Shortly before her 39th birthday, Berenice Sydney died from a sudden and unexpected asthma attack. It was 1983 and at this point Berenice Sydney was a well established Artist having exhibited in more…
Me and my memories- racing towards obscurity, one of us makes up lies, the other makes up chords we wind up in the same song I don’t have any more dreams coming true, you’re leavin’ & packing…