>> Hey friends, did you know that you can use
the Docker CLI to deploy a container to Azure Container Instances?
Best of all, there's no infrastructure management to worry about.
Chad Metcalf from Docker is here to show me
how it works today on Azure Friday.
[MUSIC].
Hey, friends. I'm Scott Hanselman and it's Azure Friday,
I'm here with Chad Metcalf from Docker, how are you?
>> I'm Excellent. Thank you for having me.
>> I'm having a lot of fun on Azure Friday because we're not just
bringing folks in from Azure and the Azure engineering team,
we're starting to bring folks in from outside.
I really like the way that
Docker and Azure Container Instances work together.
You've brought me some cool stuff to show demos, demos, demos.
>> Yeah, and we will hopefully,
pray to the demo gods and everything will go well.
>> I'm sure it's going to go fantastically.
I've been learning about how to make Azure Container Instances.
I've seen how to do it with like AZ and then a complicated thing.
But I spent a lot of time in Docker.
I recently did a YouTube video on Docker.
The Docker CLI makes me really comfortable.
Maybe you can show me how yours works.
>> I will and it's interesting.
I won't show the Azure console and I don't have AZ installed.
>> Oh, you don't have it on your machine?
>> Nope. We're going to do this all from Docker.
>> I love it. Let me switch to
your screen and tell me what you got here.
>> We're going to use Minecraft as an example.
I think it's fun.
It's a fun thing that I've had to spin up recently.
It's a Java application.
We're going to use the Java version
and we're going to show how that would work.
Let's look at the compose file for this.
I'm using Compose even though it's
just one container because it helps me.
It helps me not have to type a bunch of flags.
Let's talk about how this is.
This is a composed file.
I'm going to pull in this image from Docker Hub.
I'm going to expose a port.
It's going to be the same port on the outside,
that is on the inside of the container.
I want this to restart.
If the Minecraft server crashes,
I'd like it to come back automatically.
I'm going to set some environment variables
which will help me tweak
the Minecraft Server that comes up without having to
do special hardcoded configuration files.
I need to say, ''Yes,
I agree with EU law.''
I'm going to set a message of the day.
I'm going to set a fun seed and
I'm going to do some memory management.
I'm also going to create a volume so
that I can keep the same world over time.
If I build a cool house,
I want it to be there the next time I started.
We're going to restore all that in a volume.
>> This is really cool because it's very representative.
It's fun because it's Minecraft.
But this is like a production thing because
your production apps are going to
have volume mounting for persistence.
They're going to have restart policies.
They're going to have port mapping.
I mean, memory management.
Minecraft is a production thing.
>> That's right. In this case,
the memory here, what I'm
actually doing is I'm setting the Java heap.
I'm setting the init heap and
I'm also pinning that to the max heap.
I'm basically saying, ''Hey, in this container,
you're going to get all the memory associated
with this container and just go ahead and use it all.
Don't wait to grow the heap, just grab it.''
Let's get started. We're going to do,
Docker-Compose, and we're going to say,
this is the local version,
and I'd like you to kick it up.
Oh, I got ahead of myself.
It failed because of this thing called context.
That's a cool thing that we'll be talking about a little bit.
I'm actually, if you notice in the bottom corner,
I'm in the ACI contexts right now.
That's not any good for trying to run something locally,
so I'm going to actually switch.
>> That's actually interesting, if we may,
for just a moment here, before you hit "Enter",
you've got the really cool prompt because you're using
Posh. All my Posh.
You're inside of the Windows Terminal and
you've got this lovely thing.
You've added to your path there,
that ACI there with a Docker Moby on the right,
that's been added there, right?
>> That's right. I'm actually using PowerShell.
I'm actually in WSL 2.
>> But you're in WSL 2.
Oh, so you're in a PowerShell Core in WSL 2.
That's fancy. I love it.
>> I need to switch my context so I
can run against the local engine.
The local Docker that's running on this Windows box.
I'm going to do Docker context and let's just
look at real quick that I've got a couple of them.
I've got ACI and Default,
and I'm going to use Default.
Now, if I go and do this, it's going to actually work.
Because I have a container engine locally that can run this.
It's going to start up and these are the logs as they scroll
by. It's up and running.
>> Slick. You're listening on
localhost where the effectively 0003.
>> Let's just go see where this is.
One thing about this,
is I need to grab the WSL 2 IP address because I'm going to.
>> I see you're going to direct connect from
Windows Java Minecraft into WSL 2.
>> That's right.
>> All local to your machine right now.
>> All local to my machine right now.
Now I'm in Minecraft and I'm in my world.
>> Doing your thing.
>> Doing my thing. We can see that I
joined and that I joined from,
effectively, the Windows host for that WSL 2 box.
>> Sleek. WSL 2 continues to impress.
The fact that you using PowerShell and the cool thing,
I thought it was PowerShell on Windows.
You're destroying the flexibility of Windows as a Dev Machine 2.
Of course, you have Docker desktop here, in order to do this.
>> That's right. My setup,
and I've been doing this and since I started working from home,
is I had a really great desktop that
I built as a Christmas present to myself.
I've got lots of ram and cores and I have a very tiny laptop.
I said, ''Well, I'm home.
I'm going to use this as my daily driver,
I'm going to figure it out."
I got the new version of
Windows Terminal which I hadn't ever used before.
I set that up to use WSL 2 by default.
I set up my normal Linux environment within
WSL 2 and I just live in WSL 2 now.
It's super sleek.
But I feel bad because I came on your show and I brought
a really cool Minecraft Server and you can't connect to my house.
>> I didn't want to say anything but I was low-key offended that I
was not able to connect to your WSL from here.
>> But like any good host gift, I thought about,
well how could I, without having to go set up a server somewhere,
how could I bring this to Scott?
That's the next piece.
What if I could do the exact same thing?
Using Compose and not having to worry
about servers and just launch a container somewhere.
We can because Docker and Microsoft work together around
the Azure Container Instance
and built something where Docker can go straight in.
Let's look at what that would look like in this compose file.
It's only slightly different.
The differences are I'm going to add a deploy stanza right here,
where I'm going to tell ACI that I'd
like some different resources than by default,
I'm going to grab four gigs of memory and I only need one CPU
because Minecraft is single
threaded and if tossed too in there it wouldn't matter.
The really slick part is I'm going to
use Azure Storage for the persistence.
I'm just going to toss in a storage account and a share name
and Azure is going to take care of the rest along with Docker.
I'm going to do docker-compose up just like I did before,
except that this time it's going to go direct to Azure.
>> Again, you don't have ACI installed,
you're just using Docker that you already know how to use.
>> Little easy.
>> Look at that.
>> Also I'm not going to the Azure console,
I'm just going to launch it direct.
Let's see what that would look like.
I do need to get a context.
I've already done this,
but the way folks following
along at home would do this is they would
just Docker login to Azure.
What that'll do is it'll pop up a browser.
They just use their Azure credentials to log in and then
we securely merge that in and then you'll get a context,
which is the ACI bits.
I'm going to go back and switchover.
Docker context use ACI.
Now everything that I typed
when I say run something or Docker compose something,
it'll go to ACI as opposed to my local Docker.
I'm going to do Docker compose.
You'll notice here there's one trick, there's no dash.
One of the things that we're doing is
this Indiana Jones golden idol swap.
Docker dash Compose is
a Python project that we've had for a long time.
We're actually building compose directly into
Docker and ACI is one of
the first backends to use
the quote-unquote "new compose" that's being built directly.
Docker dash compose is a separate tool.
Docker space compose is Docker's version of
compose and ACI is the first place that that's going to work.
I'm going to say ACI, compose up.
You'll notice this is a slightly different feel for
how the UI works were making
the resource group and then we're creating the ACI.
I guess it's redundant to say ACI Instance.
But we're creating basically
the container right now so that's launching.
That takes about 30 seconds for Minecraft is my experience.
>> We can see on the right-hand side there
you've got your little timer
going and the animation is happening.
Other resource group is
just a logical group and then the Minecraft is already done.
Look at that, in just 30 seconds.
>> This is just a Docker container.
We can go look at the logs for it.
I should actually type logs and I'm going to want
to follow that so that we can actually tale it.
These logs are coming from Azure and we're tailing
the logs from Azure as this process kicks up.
It'll take a little bit longer to get bootstrapped into Azure.
But while this is starting,
you'll see that it's setting the initial memory
to four gigs and Max to
four gigs that came from that environment variable that we set.
>> What IP address will it have?
Will it have a domain name or what kind of options
do I have about where this was going to actually show up?
>> Well, let's go look. That's a great question.
The way you would find that in Docker is just
asking for Docker ps.
That went out to Azure and asked and there's where it is.
If you would like to get ready to join me,
you can go to this IP address at the standard Minecraft port.
I'll tell you when the log say that the
server's up and then you can join in as well.
>> Cool. I went and I launched
my Minecraft Java locally on my machine,
and I typed in that IP address and the standard port.
>> That's right. The fun thing
about any Java app is occasionally you get these random errors.
I at first I was like, was that bad?
It turns out that, that just what Minecraft does
when it needs to generate this new world and
I had another world previously,
so I don't mind that it's not a real air.
>> Okay. We'll fast-forward time at
this point and it will go like Wayne's World.
[MUSIC]
>> It's up and running.
>> Cool. Let me switch over to my desktop and hit "Join server".
>> I will as well.
>> It says connecting to server.
>> Joining world. What's happening?
Look at this. Here I am.
This is my computer and this is me. Up there you are.
You just join the game. We're getting paid for this.
That's the art. That's crazy.
>> Look right there. I found you.
>> Where are you?
>> Hello.
>> Look at this, I was hanging out in Docker, live in the dreams.
>> Pretty fun.
>> Fantastic. Is this like a preview of a preview of
a thing that you say I can maybe doing them in
a minute or can people don't do this like right now?
>> People can do this right now.
The way that you can follow along at
home is going to the Docker blog.
You'll find deploying a Minecraft Docker server to the Cloud.
There's a link in here for some free credits for Azure.
If you don't have an Azure account yet,
you can go here, click on this link,
get an Azure account, get it all set up.
Then you can download Docker Desktop.
This integration is built into
Docker Desktop and you can just follow
this blog along at home and you
too can be playing Minecraft with your friends.
>> Fantastic. This is really cool.
I am learning all about how I can get my stuff into the Cloud with
Docker and Azure Container Instances today on Azure Friday.
>> Hey, thanks for watching this episode of Azure Friday.
Now I need you to like it.
Comment on it, tell your friends retweet it,
watch more Azure Friday.
[MUSIC]