[Intro Music]
Alright, let's go on. And let's
first quickly summarize what we did
in previous lectures. We have used
the mongo image, and we have
created different containers, mongo
containers based on that image. And
we have seen that every container
will actually have its own
database. And when you create a new
databases, collections, records
inside of that container, it will
belong only to that container. And
as soon as this container goes
away, it is stopped or removed,
then this database is removed as
well. But very often, especially
during development process, you
need to have persistent database on
your computer and have access to it
from different containers that you
start. And we have explored that it
is possible to achieve this using
volume mapping. And in such case,
different containers that were
running mongo, were able to work
with the same database. Let's now
proceed and next let's try to
create the 'wordpress' container.
WordPress is a very popular CMS,
Content Management System; and it
is used very often. There are a lot
of custom templates that you're
able to use and you're able to
create the website pretty fast and
quickly using WordPress. WordPress
uses PHP and MySQL. And that means
that WordPress requires working
connection to MySQL database.
Alright, let's now create container
using wordpress image, and let's
immediately use 'docker run'
command with wordpress image as
argument. Let's do so. 'docker run
wordpress'. Unable to find image:
'wordpress:latest' locally. As
usually pulling 'fs' layers from
Docker Hub. Let's wait a bit and
I'll get back to you when this
process will be finished. All
right, image was successfully
pulled and afterwards WordPress
tried to start. You see some logs.
For example this one, 'WordPress not
found in '/var/www/html -
copying now...'. But finally, we see in my
case, actually, I see this error
'caught SIGWINCH shutting down
gracefully'. And I am actually back
to terminal. And it seems that
there are no containers currently
running. Yes, that is the case. And
basically, let me try to relaunch
this container. Probably something
went wrong during startup. Let me
clear terminal and run container
using 'docker run' command; and here
will be 'wordpress'. Let's run it
again. And it seems that now
WordPress is run. Let's open up a
new tab, 'docker ps'. And yes, I see
that this container is now running.
Here is the IMAGE that was used for
launch of this container. Here is
CONTAINER ID. Here is the random
NAME for this container. And also
you see that this container listens
at Port 80 over TCP. And that's
basically reasonable because
WordPress uses Apache web server,
and you are able to connect to
WordPress over HTTP port 80. You're
also able to set up HTTPS port if
you want to, but default port is
80. Also you see the COMMAND
that was executed here is 'docker-
entrypoint.sh'. I have explained you
such approach in creation of new
containers in previous section
where we have talked about mongo
containers. Again, in such case,
instead of just single command,
single script is executed, 'docker-
entrypoint.sh' script. Great.
Now we are not able to connect to
this container over port 80,
because we have not created port
mapping. We have used simply command
'docker run wordpress'. Actually, I
see that this container was again
stopped after some time. And if I
will check it here, I'll see
nothing here. Let me actually try
to run this container probably with
option '-d' in background and
with port mapping. So let's use
'docker run -d' in background;
and here will be port mapping; and
let's use external port 8080; and
internal port will be 80, that you
see actually here in this output.
So let's try to start WordPress
like so. Enter. Docker CONTAINER ID,
here it is. Let's have a look at
the containers now, 'docker ps'.
And it seems that now container is
running. Wonderful. Now let's go to
the web browser and try to open
session to port 8080. Again, you're
able to use any local IP address of
your computer, either localhost or
127.0.0.1 or any other IP address
assigned to any of your interfaces.
So let's go to Google Chrome and
type here localhost:8080.
And we see WordPress setup
configuration. And let's choose
English here. Let's actually
make it a bit smaller like this, and
click here 'Continue'. We're
actually able now to perform
initial configuration of WordPress
and we will need to specify
Database name, Database username,
Database password, and Database
host. Let's click, 'Let's go!', and see
what will happen. And here we are
prompted to setup database
connection including Database Host.
Notice that here by default it is
set to 'localhost'. Let's try to
'Submit', and see what will happen. 'Error
establishing a database connection';
and that means that there is no
database at the moment; and we are
not able to perform initial
configuration of WordPress. MySQL
database is absent by default out
of the box in this 'wordpress'
container. It has Apache web server
but it doesn't have MySQL database.
And you need to create a MySQL
database somewhere else. And of
course, you're able to create
additional container and
connect two containers - 'wordpress'
container and 'mysql' container. And
let's try to launch 'mysql'
container next. I'll see you after the small
pause. Bye-Bye.
[no audio]