Container Fundamentals | Part 3 - Shared Folders
0 (0 Likes / 0 Dislikes)
[The Containers Channel]
[Container Fundamentals Shared Folders]
[Container Fundamentals Shared Folders Microsoft]
>> Hello, and welcome to another episode
[Container Fundamentals Shared Folders
Microsoft
Matt McSpirit Technical Evangelist]
on The Containers Channel.
[Container Fundamentals Shared Folders
Microsoft Matt McSpirit Technical Evangelist]
I'm Matt McSpirit, technical evangelist
for our datacenter technology,
[Container Fundamentals Shared Folders Microsoft]
and I'm joined again by Neil Peterson,
[Container Fundamentals Shared Folders
Neil Peterson Senior Content Developer]
a content developer
[Container Fundamentals Shared Folders
Neil Peterson Senior Content Developer]
working on our containers technology.
[Container Fundamentals Shared Folders
Neil Peterson Senior Content Developer]
And in this episode,
[Container Fundamentals Shared Folders]
we're building on our previous episodes
[Container Fundamentals Shared Folders]
Now those who've been following along,
[Container Fundamentals Shared Folders Microsoft]
you'll know we've covered things
[Container Fundamentals Shared Folders Microsoft]
like an intro to containers,
just getting people up to speed
[The Containers Channel]
with what they are and what they can do for you.
[The Containers Channel]
Then we looked in depth around some of the images
[Container Fundamentals Shared Folders Microsoft]
and networking components around containers
[Container Fundamentals Shared Folders Microsoft]
and how they are very portable across
local work stations, servers,
[Container Fundamentals Shared Folders Microsoft]
the datacenter, and even into the cloud,
[Container Fundamentals Shared Folders Microsoft]
so definitely check those out
if you haven't seen them.
[Container Fundamentals Shared Folders Microsoft]
But in this episode,
we're gonna be focusing in more on
[Container Fundamentals Shared Folders Microsoft]
some of the capability around
storage for containers
[Container Fundamentals Shared Folders Microsoft]
and how containers use storage.
[Container Fundamentals Shared Folders Microsoft]
So, Neil, bring us to speed
with shared folders
[The Containers Channel]
and why this matters to containers
and perhaps where we were in TP3
[The Containers Channel]
and where we are in technical preview 4 now
[Container Fundamentals Shared Folders Microsoft]
around shared folders.
[Container Fundamentals Shared Folders Microsoft]
>> Sure.
[Container Fundamentals Shared Folders Microsoft]
So with both Windows server containers
and Hyper-V containers,
[The Containers Channel]
at TP4 we released the capability
of shared folders
[The Containers Channel]
and it's a pretty simple capability,
[Shared Folders The Containers Channel Microsoft]
just allows us to expose a folder
[Shared Folders PowerShell: Docker:]
from the container host
to containers running on that host.
[Shared Folders PowerShell: Docker:]
>> Right.
[Shared Folders PowerShell: Docker:]
>> Basically once we've done this,
[Shared Folders PowerShell: Docker:]
we can share files with the container.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
We can also share files between
containers running on that host.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> Between Windows server containers?
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> Windows server containers
and Hyper-V containers as well.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> Alright. Okay, great.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
So this didn't exist before technical preview 4?
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> Yep.
>> Right, okay. This is new.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> New to TP4.
>> Okay.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> So just a recap, so I've got a container host,
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
I would create a container
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
shared folder between the host and the container.
[The Containers Channel]
>> And is that so when you create,
[The Containers Channel]
the container host could be physical or virtual.
[The Containers Channel]
>> Yep.
>> Yeah.
[The Containers Channel]
Just an operating system
that's got a container's capability.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
On that host you're using,
can you exclusively use PowerShell
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
to create it or...
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
The shared folder or can you just
right click a folder
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
on your normal host and create it that way?
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> So we create the shared folder
once the container has been created.
[The Containers Channel]
>> Alright. Okay.
[The Containers Channel]
>> And we would do that either
using PowerShell or Docker.
[The Containers Channel]
>> Right.
[The Containers Channel]
So this is different for me creating
a shared folder on my desktop.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> Yep, yep.
Totally different thing.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> Yeah. Fair enough.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> And once we've created that,
so if I create a shared folder
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
between multiple different containers,
so same folder on the host
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
presented to multiple different containers.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> Yeah.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> Each of these containers
can see the files within the folder,
[The Containers Channel]
so I can actually write a file
from one container into that shared folder
[The Containers Channel]
and access that file on another container
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
that's mapped to the same shared folder
and we'll see a example of that.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> So I'm guessing that could be
relevant for scenarios
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
where for instance you've got web front-ends
accessing a central database
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
or accessing a shared images
repository for images
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
that are hosted on the sites,
those kind of things.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> Yeah, I mean, there's ton of possibilities.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> Okay.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> So initially, I mean,
it's really great for doing things
[The Containers Channel]
like getting files into your container
[The Containers Channel]
such as I need to install
an application in this container,
[The Containers Channel]
I'm gonna use a shared folder
to get those files into the container,
[The Containers Channel]
so that I can solve the application
and then all the way down to more application
[The Containers Channel]
specific use cases like you discussed there.
[The Containers Channel]
>> Right, and the source path,
you don't have to create
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
the shared FOLDER brand new,
you could, could you use
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
an existing folder
that's got stuff in it already?
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> Yep, yep. Absolutely.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> Okay. That's good.
>> So let's take a look.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
As I mentioned there is two different ways
to create shared folders,
[Shared Folders PowerShell: Docker:
Add ContainerSharedFolder -ContainerName demo
-SourcePath c\DestinationPath c\destination]
we can use PowerShell.
[Shared Folders PowerShell: Docker:
Add ContainerSharedFolder -ContainerName demo
-SourcePath c\DestinationPath c\destination]
We've got a command Add-ContainerSharedFolder.
[Shared Folders PowerShell: Docker:
Add ContainerSharedFolder -ContainerName demo
-SourcePath c\DestinationPath c\destination]
>> Pretty much explains what it does.
[Shared Folders PowerShell: Docker:
Add ContainerSharedFolder -ContainerName demo
-SourcePath c\DestinationPath c\destination]
>> Yep, absolutely.
[Shared Folders PowerShell: Docker:
Add ContainerSharedFolder -ContainerName demo
-SourcePath c\DestinationPath c\destination]
And then we specify a source path
[Shared Folders PowerShell: Docker:
Add ContainerSharedFolder -ContainerName demo
-SourcePath c\DestinationPath c\destination]
and a destination path.
[Shared Folders PowerShell: Docker:
docker run-it -vc\source:
c\destination nanoserver cmd]
And then using Docker,
[Shared Folders PowerShell: Docker:
docker run-it -vc\source:
c\destination nanoserver cmd]
when we run a Docker container
[Shared Folders Docker: docker run-it -vc\source:
c\destination nanoserver cmd]
or when we create the container,
we can specify -V,
[Shared Folders Docker: docker run-it -vc\source:
c\destination nanoserver cmd]
and again specifying the source path
and the destination path.
[Shared Folders Docker: docker run-it -vc\source:
c\destination nanoserver cmd]
>> Right.
[Shared Folders Docker: docker run-it -vc\source:
c\destination nanoserver cmd]
So essentially with these shared folders,
[Shared Folders Docker: docker run-it -vc\source:
c\destination nanoserver cmd]
is it that they are only made shared
at the point a container is using them?
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
Is that a tricky question?
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> That was a tricky question.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> So we'll see, we'll look at it
in the demo anyway.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> Yep.
[Shared Folders PowerShell: Docker:
Microsoft The Containers Channel]
>> Yes, so you want to take us through it?
[Microsoft The Containers Channel]
>> Yeah, let's just take.
[Microsoft The Containers Channel]
>> So he's trying to understand
because every time you say
Docker run, you're creating
a new instance for the container
and then you're saying,
okay, use the shared folder.
Does it stay shared
for the remainder of the time?
>> It's shared with the container itself.
>> Right. Okay.
>> Yeah, we'll just take a look
and we'll see where we are that.
So what I'm gonna do here is
I'm just gonna create
two containers really quickly.
>> And this is with PowerShell.
>> This is with PowerShell,
so nothing special here,
a new container, giving it a name,
selecting an image
and connecting it to a switch.
>> And this is regular Windows server containers?
>> Regular Windows server containers.
They've been created, and now
while they're turned off,
so this is a requirement at this point
that they need to be turned off
to present the shared folder to them.
>> Okay.
>> I'm gonna run this command
Add-ContainerSharedFolder.
I'm gonna select both of my containers,
and you can see,
I've got my source path here,
so talking about
or addressing one of your questions,
you'll see here that my source path
already has content in it.
So I've got a file in my source path
and then specifying a destination path.
So I go ahead and run this.
>> One thing that's interesting
before you click go there is,
you're actually on a full GUI version
or a server with the desktop experience
to use the correct terminology
for your container host.
>> That was impossible
in TP3 either, was it?
>> Nope.
>> It was only the core
essentially version.
>> Yep.
>> So that's something new,
so if you were wondering,
"Oh, hang on, how're you running
containers on a server
with a desktop experience?"
Yeah, it's part of TP4, so based on feedback.
>> Yeah, so at TP4 we've got
Windows server full,
Windows server core
and then server container hosts.
>> Okay. Great.
>> And to size up the environment,
yeah this is a VM running on my laptop
that has full server on it
and it's also my container host.
>> Cool, okay. So go for it.
Launch the...
Pull out the shared folder.
>> Yeah, and so that was really quick.
>> So you've got access mode rewrite there,
is there anywhere that that can be constrained?
>> Yep, absolutely can be.
So if I do add container shared folders,
I'll do a container name, demo 1.
I'll just use source path,
I'll do just do something real quick.
>> I did see that access mode
is an option there.
>> Yeah, and then so we've got access mode
and then we've got read only or read write.
>> Excellent.
>> Thanks.
>> You didn't have to type
all that out for me but thank you.
>> No worries. No worries.
Right, so I'm gonna ahead
and start these containers.
And now I'm actually gonna create
some sessions with these containers.
And if I go to the root of demo 1
and do an LS,
you can see there as my file's directory
was created,
so that's the shared folder.
And if I do...
We can see the one file that was already there.
>> Right.
>> So back on the host,
if I create a folder...
Create a file, I'll just do a text file...
run this command again.
>> There it is.
>> There it is.
>> Yes, so that is a pretty useful way
to get files into a container
or obviously a more useful one
that stops the share across container.
>> Yep.
And so here I am over on demo 2.
I do...
>> There you go.
>> We get the same thing, so...
>> So now you're essentially
writing something from the container.
>> Yeah. So in container demo 2,
I'm creating a file.
There it is, container 1.
You can see there is my test 2.
>> Nice.
>> And then back on the host
there is the text file.
>> Cool.
>> So pretty simple.
>> Yeah.
>> So that was, this with PowerShell.
[Windows Server 2016 Technical Preview 4]
We'll just take a look at Docker as well.
So I'm gonna do Docker images,
post my images, so Docker run,
-it.
>> So that's the interactive session.
>> Yeah, interactive session -v for volume.
>> Right.
>> And then my source,
so I'll just do...
>> So that -v is the key
to shared folders, right.
>> Yep. That's the key.
>> Would they be the same,
I mean, now would it be the same
on Linux if you use -v?
>> It is, right.
>> Okay.
>> Yeah.
And there is Docker documentation
around this procedure right here.
>> Okay.
>> And then I'll do files, select my image.
>> File or files? Here we go.
>> Yeah.
>> And the process...
>> Gonna have no problems from there.
So this is going to create a new container,
start it up with that file shared maps
already from that base image,
and launch the command prompt from that.
>> Right.
So now we're in the container
and if we go to the root of C...
We can see that we've got the files
that we actually created
in the Windows server containers.
>> Right, nice.
>> Cool.
>> That's two ways to do,
so you have done it first
with PowerShell against the same Windows server
[The Containers Channel Microsoft]
or with the same type
of Windows Server Container,
[The Containers Channel Microsoft]
obviously with different containers
created each time, demo 1, demo 2,
[The Containers Channel Microsoft]
and then one created in Docker.
[The Containers Channel Microsoft]
>> Yep.
>> Easy stuff.
[The Containers Channel Microsoft]
>> Yeah, so that was
a very simple example of, you know,
[The Containers Channel]
presenting the shared folder,
copying files back and forth.
[The Containers Channel]
And we've talked about, you know,
there's multiple things we can do here,
[The Containers Channel]
getting content into the container
so we can run it,
[The Containers Channel Microsoft]
but there is also potentially
several different applications
[The Containers Channel Microsoft]
for this running containers
and as we build applications.
[The Containers Channel Microsoft]
So I built just a very simple
little demonstration here
[The Containers Channel Microsoft]
where I've got...
[nepeters.com]
In fact, let me, I've got some content
on this in the PowerPoint.
[Shared Folder Demo Demo 1 - Basic creation
Demo 2 - Docker Demo 3 - Load balanced app
Container Host]
I can size up my demonstration here.
[Shared Folder Demo Demo 1 - Basic creation
Demo 2 - Docker Demo 3 - Load balanced app
Container Host]
>> Yeah. Nice.
[Shared Folder Demo Demo 1 - Basic Creation
Demo 2 - Docker Demo 3 - Load balanced app]
Container Host]
[Shared Folder Demo Demo 1 - Basic creation
Demo 2 - Docker Demo 3 - Load balanced app
Container Host]
>> So what I have here is a container host
[Shared Folder Demo Demo 1 - Basic creation
Demo 2 - Docker Demo 3 - Load balanced app
Container Host]
running a couple of different containers.
[Shared Folder Demo Demo 1 - Basic creation
Demo 2 - Docker Demo 3 - Load balanced app
Container Host]
One of these is a load balancer.
[Shared Folder Demo Demo 1 - Basic creation
Demo 2 - Docker Demo 3 - Load balanced app
Container Host]
>> Right.
[Shared Folder Demo Demo 1 - Basic creation
Demo 2 - Docker Demo 3 - Load balanced app
Container Host]
>> It's going to load balance traffic
[Shared Folder Demo Demo 1 - Basic creation
Demo 2 - Docker Demo 3 - Load balanced app
Container Host]
across two containers running a web server.
[Shared Folder Demo Demo 1 - Basic creation
Demo 2 - Docker Demo 3 - Load balanced app
Container Host]
What the application does is
[Shared Folder Demo Demo 1 - Basic creation
Demo 2 - Docker Demo 3 - Load balanced app
Container Host]
each time the web server is accessed,
[Shared Folder Demo Demo 1 - Basic creation
Demo 2 - Docker Demo 3 - Load balanced app
Container Host]
it's just gonna write a log file
[Shared Folder Demo Demo 1 - Basic creation
Demo 2 - Docker Demo 3 - Load balanced app
Container Host]
with the name of the container
[Shared Folder Demo Demo 1 - Basic creation
Demo 2 - Docker Demo 3 - Load balanced app
Container Host]
that generated the log file.
[Shared Folder Demo Demo 1 - Basic creation
Demo 2 - Docker Demo 3 - Load balanced app
Container Host]
So as traffic comes in,
[Shared Folder Demo Demo 1 - Basic creation
Demo 2 - Docker Demo 3 - Load balanced app
Container Host]
it's going to hit one container, drop a log file.
[Shared Folder Demo Demo 1 - Basic creation
Demo 2 - Docker Demo 3 - Load balanced app
Container Host]
That log file is going to go into a shared folder
[Shared Folder Demo Demo 1 - Basic creation
Demo 2 - Docker Demo 3 - Load balanced app
Container Host]
that's shared across
[Shared Folder Demo Demo 1 - Basic creation
Demo 2 - Docker Demo 3 - Load balanced app
Container Host]
both of the web servers in the solution.
[Shared Folder Demo Demo 1 - Basic creation
Demo 2 - Docker Demo 3 - Load balanced app
Container Host]
>> Nice.
[Shared Folder Demo Container Host]
>> So as we'll see traffic will come in
and drop these log files
[Shared Folder Demo Container Host]
on the container host, so this is the way
[Shared Folder Demo Container Host]
that I can actually get all of these log files
into one place and inspect them all
[Shared Folder Demo Container Host]
and kind of bring things together.
[Shared Folder Demo Container Host]
>> When you said the name of the log file
or at least data in the log file
[Shared Folder Demo Container Host]
reflects the name of the container
that was accessed,
[Shared Folder Demo Container Host]
so it might be that demo 1, demo 2,
demo 1, demo 2, demo 1.
[Shared Folder Demo Container Host]
>> It's exactly how it's gonna look.
[Shared Folder Demo Container Host]
>> Right. Okay, great.
[Shared Folder Demo Container Host]
>> Take a look.
[nepeters.com]
Very simple, I won't go through the details,
[nepeters.com]
so on this container host,
I actually have five containers running.
[nepeters.com]
There's some database aspects to this,
[nepeters.com]
but it's not really relevant
to the shared folder pieces.
[nepeters.com]
But looking at these two container right here
[nepeters.com]
NP web 2 and NP web 1
and you can also see that
[nepeters.com]
I've got a load balancer in here.
[nepeters.com]
>> Yeah.
[nepeters.com]
>> So this is the name of the container
that's going to run this app,
[nepeters.com]
that's going to write the log file.
[nepeters.com]
So here we go right here.
[nepeters.com]
And actually what I'll do
is pull up the shared folder,
[nepeters.com]
so here is the shared folder
[nepeters.com]
that's shared across those two containers.
[nepeters.com]
>> Currently nothing in there.
[nepeters.com Submit]
>> Currently nothing in there.
[nepeters.com Submit]
Run my app.
[nepeters.com Submit]
There's a log file so we can see
NP web 1, run it again.
[nepeters.com Submit]
And there is two
and I'll just slam a couple more out.
[nepeters.com Submit]
>> And need a bit more error checking
on your website though.
You know, no emails checking there.
>> Yeah. Yeah.
Cool.
So just a, you know, simple example of
a little more practical example of
shared folders
in the context of an application.
>> But as you said before,
it could be something like log files,
it could a central database,
it could be something
that you link to an application
that needs to be shared across,
across different layers or tiers of an app.
>> Yep.
>> So, real cool. Very good.
And that would be the same
whether it was a Hyper-V container
[The Containers Channel Microsoft]
or a Windows server.
[The Containers Channel]
And obviously we've not dived
into Hyper-V containers yet in the course.
[The Containers Channel Microsoft Resources]
And we will do in the future,
in a couple of episodes time,
[The Containers Channel Microsoft Resources]
but in terms of using Hyper-V containers
with shared folders,
[The Containers Channel Microsoft Resources]
there is nothing else.
[The Containers Channel Microsoft Resources]
>> Yep. Identical.
[The Containers Channel Microsoft Resources]
>> Okay, cool.
[The Containers Channel Microsoft Resources]
So with that, that brings us
[Resources Read the Containers documentation]
[Microsoft and Docker Partnership]
[Get started with Docker]
to the end of this particular episode
[Resources Read the Containers documentation
Microsoft and Docker Partnership
Get started with Docker]
of this mini series on container fundamentals,
[Resources Read the Containers documentation
Microsoft and Docker Partnership
Get started with Docker]
part of our broader Containers Channel.
[Resources Read the Containers documentation
Microsoft and Docker Partnership
Get started with Docker]
In the next episode,
[The Containers Channel Microsoft Resources]
we're gonna be
taking a look at resource controls
[The Containers Channel Microsoft Resources]
and how you can more effectively
control CPU memory
[The Containers Channel Microsoft Resources]
and so on around the container.
[The Containers Channel Microsoft Resources]
And hopefully you found this one useful so far.
[The Containers Channel Microsoft Resources]
Check out the resources,
[The Containers Channel Microsoft Resources]
download the evaluation of Windows server,
technical preview, TP4
[The Containers Channel Microsoft Resources]
if you're watching it around about now,
if you're watching it in the future,
[The Containers Channel Microsoft Resources]
then TP5 or whatever the next milestone will be.
[The Containers Channel Microsoft Resources]
Check out the documentation
that Neil and team are working on
[The Containers Channel Microsoft Resources]
to help you evaluate
some of these different scenarios.
[The Containers Channel Microsoft Resources]
We showed Docker commands as well,
so useful to have resources on Docker,
[The Containers Channel Microsoft Resources]
loads of documentation on that side as well.
[The Containers Channel Microsoft Resources]
So with that, that brings us to the end.
[The Containers Channel Microsoft Resources]
Thanks for watching.
Thanks, Neil, for your help.
[The Containers Channel Microsoft Resources]
And we'll see you again on another episode
on the Containers Channel.
[The Containers Channel Microsoft Resources]
>> Thanks.
[Resources Download Windows Server 2016
Technical Preview
Read the Containers documentation Microsoft
and Docker Partnership Get started with Docker]
[The Containers Channel]
[9 channel9.msdn.com]