[Intro Music]
Alright, as usually I hope that
you solved this challenge yourself,
and you were able to create two
containers redis and redis-commander
in separate custom bridge
network called 'redis'; and you were
able to connect from redis-commander
to redis using graphical user
interface. Now, let me do that
together with you. And first of
all, let me go to VS Code. and let
me create here a new folder inside
of the containers folder, and that
folder name will be 'redis', like so.
And here inside let me create a new
file commands.txt, similarly
as we did for previous cases, when
we have launched multiple
containers in the same network. And
here first command will be
CREATE NEW CUSTOM NETWORK, 'docker
network create', and name of the
network will be 'redis'. Next, LAUNCH
REDIS CONTAINER, and let me launch
it in this custom 'redis' network,
and I'll give it a custom name
'redis', 'docker run \',
'--name redis'. Next comes
network, '--network
redis'. Also, let me run this
container in background, and the
image name will be 'redis'. And
that's probably all what I need for
'redis' container. But if I will
require something else, I'll edit
later. Great. Let's next
launch redis-commander,
LAUNCH REDIS-COMMANDER CONTAINER, and
I'll launch it using same command
'docker run \'. Let's give it
name, '--name redis-
commander', like this. Next comes
network, we will create this
container in the same redis
network, '--network redis \',
I'll also run this container in
background. And here will be the
name of the image. Let me go to
Google Chrome and click on this
image, 'rediscommander\
redis-commander',
let me copy this name from here, and
paste here, like so. Also, let
me scroll down here, and somewhere
in those settings, you may find
default port, it is 8081. But of
course, if you need you are able to
adjust this port number. Let me go
back to VS Code, and here let me
add the port mapping, '-p',
and external port I'll use same as
internal; 8081, and internal
will be 8081, like this. But
now let me quickly tell you a few
words about redis-commander.
Actually it is available as you see
here as Docker Image, but it is also
available as NPM package for Node.js,
because actually redis-
commander is written in Node.js,
and you may read this information
here, and you are able to install it
either using npm or use
container, here it is; and we are
actually using it as a container.
Let me scroll down here, and let me
show you which environment
variables we should use for this
container. Here you see a set of
environment variables, and here a
set of additional environment
variables like REDIS_PORT,
REDIS_HOST; and now let's set
only single environment variable,
REDIS_HOST, and as a value, we will
specify simply 'redis' as the name of
the redis container. Alright, let
me copy REDIS_HOST environment
variable here, and go back to
configuration of this container,
and let me add environment variable
'-e REDIS_HOST=
redis', like this. And it seems that
that's all what I will need in
order to start this container. But
again, I haven't done it before and
if I miss something I'll add
additional configuration parameters
here later on. For now that's it.
Let me save this, and let me copy
first command, 'docker network create
redis', and go to terminal in order
to start those containers. All
right, 'docker network create redis',
network was created, next let's
start redis container like this.
Let me copy this command. Container
was started. Let's go back to
redis-commander. Let me copy this
command, go back to terminal, and
start redis-commander. Recap
that we have not yet pulled redis-
commander image and that's why now
Docker is pulling it. Alright,
Pull was completed, and it seems
that both containers should be now
up and running. Let me have a look
at them, 'docker ps', and yes, there
are two containers up. And now I
could try access redis-commander
graphical user interface from a
local computer using port 8081 in
web browser. Let me go there, and
here type localhost:8081, like
this. And I'm in, and here you
actually see connection to Redis
server. Let me make it a bit
smaller like this, and let's try to
add new key, click on this
button, Add New Key', key will be,
let's say, key2, and the value
will be, 'Good day', like so. And
here, let's click OK, Save
actually, and it seems that new key
was added. Let me verify that,
you are able to expand this here,
and I'll see key2 here on the
list. Let me click on key2, and
I'll get its value here. And that
means that the redis-commander is
working, and now it communicates
correctly with Redis server. And
notice that we have not specified
any authentication parameters either
for Redis server or for redis-
commander; and we have simply looked
into redis-commander without any
username and password. But for the
sake of this challenge that's
pretty fine, and actually all what
you need to do in the redis-
commander container, you need to
specify an environment variable
called REDIS_HOST, and in our case,
it is set to name of 'redis'
container and recap that because
those containers are running in a
separate custom network, this name
redis will be resolved by Docker
Host to IP address of redis
container, this container. That's all
guys for this challenge. And now
let me quickly stop those
containers. I don't need them
anymore. 'docker stop 47', 'docker
stop ef', and 'docker container
prune', Yes. All right. That's all
guys for this lesson, and I'll see
you next where we will explore
another Docker Image. I'll see you
next. Bye-Bye.
[no audio]