[Intro Music]
Now there are two containers up and
running. And we see here that
'docker-compose' process is also
running. And let's first interrupt
this process by pressing key
combination Ctrl+C like that. You
see that two containers are now
stopping, this one and this one.
Containers were stopped. And if I
enter 'docker ps' now, I will see
empty output, because
'docker-compose' has stopped both
containers. Now let's try to rerun
both containers using the same
command as before 'docker-compose
up', but now let's run them in
background. And first let's have a
look at all options that you have
in 'docker-compose up' command. For
that, please type 'docker-compose
up --help'. Here you'll find a list
of options. In this options list,
you could find option '--build'
that allows you to rebuild all
images defined in the
'docker-compose' file. And also at
the beginning of this options list,
you should find option that is
called '-d', or '--detach'; and
this will run all containers
defined in the 'docker-compose'
file in detached mode, and that's
what we will try right now. Let's
clear terminal and type
'docker-compose up -d', this stands
for detached mode. Let's go ahead,
Starting both containers,
'images-gallery_api_1' and
'images-gallery_frontend_1'. 'done'
and 'done' here. Now, I returned to
the command prompt, and I could
continue doing other operations.
Let's have a look at currently running
containers, 'docker ps', and I see
both containers that are up and
running same as before, 'api', and
'frontend' containers. Great. Let's
now verify whether our application
works as before. Refresh page here,
search for something and they both
result same as before. Great. Now
let me show you how you're able to
stop those containers by using
'docker-compose down' command.
Let's clear terminal and type
'docker-compose down'. And it's
important to mention that you need
to run those commands like
'docker-compose down' or
'docker-compose up' in specific
folder where there was
corresponding 'docker-compose.yml'
file. Okay, let's bring down both
containers. Both containers are
being stopped at the moment.
Stopped. Also those containers were
removed. And also network that was
created specifically for
communication between those
containers was removed as well.
Network Name is
'images-gallery_default'. Let's
start those containers back again,
'docker-compose up -d', detach
mode. Creating network. Creating
containers. Notice that we don't
build new images because images are
already built. 'done' here; and 'done'
here. And containers are now again
up and running. Great. Now let's
commit the changes made in
'docker-compose' file. It is
actually its initial version. Let's
go to source control, and here our
commit message will be 'Initial
version of the docker-compose' like
that. Let's commit changes, Changes
committed. And now let's proceed
and next I'll explain to you how to
map volumes to the containers and
you'll understand why we actually
need to do that. I'll see you guys
just in a bit.
[no audio]