WEBVTT

00:00.990 --> 00:03.420
-: In last section, we learned how to start up a shell

00:03.420 --> 00:06.870
inside of a container the instant that it was started.

00:06.870 --> 00:09.150
By the way, if you have a little bit of trouble exiting

00:09.150 --> 00:10.800
from this by hitting control C,

00:10.800 --> 00:13.230
which is usually how we exit out of a container,

00:13.230 --> 00:16.290
remember you can either press control D on your keyboard

00:16.290 --> 00:18.300
or you can just type in exit like so

00:18.300 --> 00:20.460
and it will kick you back out.

00:20.460 --> 00:23.670
Now in this section, there's one very small "gotcha,"

00:23.670 --> 00:24.660
maybe not even a "gotcha,"

00:24.660 --> 00:27.090
but just a very particular thing that I want to go over

00:27.090 --> 00:29.220
to make sure that it's really crystal clear

00:29.220 --> 00:31.380
on how containers behave.

00:31.380 --> 00:33.870
I want you to recall back to a little bit ago

00:33.870 --> 00:36.990
when we were initially talking about what a container is.

00:36.990 --> 00:39.780
Remember that we gave this example of where Chrome

00:39.780 --> 00:41.760
had needed a particular version of Python

00:41.760 --> 00:44.730
and NodeJS needed it's own version of Python.

00:44.730 --> 00:47.670
And we had said that through that name spacing feature

00:47.670 --> 00:49.800
we can kind of imagine that our hard disc

00:49.800 --> 00:52.380
had two little segments carved out of it,

00:52.380 --> 00:56.010
and any time Chrome tried to access that hard drive

00:56.010 --> 00:57.420
it would get it's own segment.

00:57.420 --> 00:59.760
Any time NodeJS tried to access the hard drive

00:59.760 --> 01:02.220
it would get it's own different segment.

01:02.220 --> 01:04.230
And so the thing that I want to make sure is really

01:04.230 --> 01:06.875
crystal clear is that between two containers,

01:06.875 --> 01:10.443
they do not automatically share their file system.

01:11.460 --> 01:13.410
We're gonna do a quick demo inside of our terminal,

01:13.410 --> 01:15.900
just to really confirm that that is the case.

01:15.900 --> 01:19.200
So I'm gonna open up my terminal and I'm going to start up

01:19.200 --> 01:22.380
a new instance of that BusyBox image,

01:22.380 --> 01:24.900
and I'm gonna start up a shell inside there.

01:24.900 --> 01:27.543
So I'll do docker run -it busybox shell.

01:32.130 --> 01:34.890
So now I can list my files and folders inside of here

01:34.890 --> 01:37.710
and I see just these default folders.

01:37.710 --> 01:40.650
I'm now going to open up a second terminal window,

01:40.650 --> 01:42.900
and I'm going to start a second container

01:42.900 --> 01:44.760
with the same parameters.

01:44.760 --> 01:46.680
So second terminal window,

01:46.680 --> 01:51.680
and I'll do docker run -it busybox sh.

01:53.481 --> 01:56.430
Now I'm gonna open up one more terminal window,

01:56.430 --> 01:58.030
so this is gonna be a third one.

01:58.920 --> 02:01.230
And inside of here I'll do docker ps,

02:01.230 --> 02:04.170
and I can verify that I have two separate containers,

02:04.170 --> 02:05.733
both running a shell.

02:06.660 --> 02:09.060
Now I'm gonna go to the first terminal window

02:09.060 --> 02:11.400
and inside of here I'm gonna create a new file

02:11.400 --> 02:14.910
with touch hi there, like so.

02:14.910 --> 02:17.730
That's gonna create a new file called Hi There.

02:17.730 --> 02:19.241
There it is right there,

02:19.241 --> 02:22.680
I can li- run LS and I'll see the file up here right away.

02:22.680 --> 02:23.730
Now here's the fun part.

02:23.730 --> 02:26.373
We're gonna go over to the second terminal window,

02:28.260 --> 02:30.720
and I'll do an LS over here as well.

02:30.720 --> 02:33.810
And of course, I am not gonna see that file of Hi There,

02:33.810 --> 02:35.400
because these two running containers

02:35.400 --> 02:38.520
have absolutely, completely separate file systems,

02:38.520 --> 02:41.063
and there's no sharing of data between the two.

02:41.063 --> 02:43.380
Again, this is kind of a small thing, but I just wanted

02:43.380 --> 02:45.780
to make sure that it was very crystal clear.

02:45.780 --> 02:49.140
So in general, unless you and I specifically form up

02:49.140 --> 02:50.970
a connection between two containers,

02:50.970 --> 02:53.610
we really considered them to be more or less

02:53.610 --> 02:57.240
completely isolated from each other and totally separate.

02:57.240 --> 03:00.660
Alright, so that's pretty much it on the basics of Docker.

03:00.660 --> 03:02.490
So we're gonna take a quick pause right here.

03:02.490 --> 03:04.440
We're gonna come back the next section and we're gonna start

03:04.440 --> 03:07.140
moving on to the next big topic that we're going to cover.

03:07.140 --> 03:08.790
So I'll see you in just a minute.
