 Let me speak in English, and sorry for my bad English. Well, next speech has a very singular name. How to write a blue wane. Isn't it beautiful? Now we're going to see basics of writing this new blue wane and help yourself with content. I'm so sorry. We are going to listen to Nemanian Sima Levy talking about doctor. So I have to tell you something about Nemanian. Because Nemanian is the second time that he's coming to work on Las Palmas de Gran Canaria. Last year he was a volunteer and he's a VHP developer, WordPress enthusiast and open source advocate. And I like one sentence I read in the biography because she said WordPress is idea and cause. So let me introduce you to Nemanian Sima Levy. Thank you. I will go with Spanish, I guess. So we're here today to talk a little bit about doctor and how it can maybe help you improve your working processes and how you can use it on your development, what doctor is and what definitely isn't. As we said, I'm a VHP developer. I started working in 2004-2005. I basically work in VHP most of my time. WordPress is just one of the passions that I have. And lately I jumped into the server, architectures, DevOps and all that stuff. So here are some fancy terms that usually we'll try to sell to our clients like containerize that, microservices, Kubernetes form, debt-like production, continuous integration, blah, blah. That's not what I will talk today. So not docker in this sense. First thing I want to just make a distinction is what docker isn't. A lot of people tend to mix it with virtual machines and in a sense it's not really that. If we check like this, let's say we have the same set of three applications this top set. The big difference comes on the hypervisor level where when you have a virtual machine you will need to have like hypervisor that will provide your environment for the guest of the system. For docker you don't have that. It relies on the help of your kernel. This means if you try to use something like running docker on Windows machine without virtual machine it will most likely fail. It will fail if you try something that will fail. But sometimes it will even fail on the OS X. So it's not just about Windows. This is something we run internally in our company for development purposes. So as you can see we are running the virtual machines and docker on top of that. So that's one thing that usually people mix. So you can use them together. It's not that I will use either this or that. Anyway, let's give you some turns that can make a confusion for the first time. Here uses a docker like on a database. Who tried it and after five minutes not figuring out how it works just pushed it away. I was in that room for like a year. I tried it and it didn't work out and I just pushed it away. So first there is an image. Consider this how many developers we have and how many developers we have. Consider an image as a class. So it's just an application of what you will have when you create an instance. So it's your starting point. You define some set of commands, some functions, libraries that you will have included in your container later. It's status, definitely. And it will not change unless you make a change in it but in that case you are basically creating your own image. The next thing we have a container. It's a runtime of your instance so it's literally if you shift it to the developers vocabulary it's like when you create an instance on a class. It can change in time but it will be based on that class that you had originally. And we have a host. What I mentioned before, the host is the machine that will run your Docker and on top of that you will have your containers. Try not to mix different operating system when you try to do this. Once again, I tried it on Windows first time. It was horrible and that's why I pushed it away. As I mentioned we will not talk about fancy things but I will stick with CLI commands and how you can easily set up your environment how you can easily in like five minutes get going with your WordPress development using the Docker. So it's not really a workshop but I will show the actual commands and how you can do it. First like on Windows like I said I installed it a long time ago on OS 6. There is now a UI for Docker but to be honest you can simply install it using the VM that's my setup. So I have a VM in that VM I have Docker installed as a CLI and everything I do basically I do from the VM. Synchronization works properly so we will not have a problem with that most likely. I had one developer who actually had a problem when he tried to sync the data from the container to his operating system. He just didn't work. So we just install Docker over again all of a sudden it works. So remnants, I don't know how else to say that. Like any other command that you have in the CLI the Docker also has its own command. It has set of options that are different per container per image you are using and it usually can define an explanation for that image. The good thing about Docker is for different images you don't have to build them yourself. You can use Docker Hub where you can find various images and just push them up as you need. One of the examples I saw on the Docker conference was a guy who received a router file. He came on OS6 in 2018. He was like, how should I do this? I don't want to install it. He actually used Docker. He pulled over the Docker image for uncompressing the router files. He uncompressed that file on his walking machine using Docker. And all that it takes about to download and to execute, let's say, 30 seconds. So even faster than to just download the whole application and do that. The good thing about Docker, on the other hand, is its speed. Let's say you want to run VM. You run, let's say, right on top. It will take how much? 15 seconds to get your machine out of running. And you run this moment if you already have image downloaded on your machine. It will take about, let's say, 30 seconds. Your machine will be up and running. So it's really great for testing. It's really great for quick development. But you can play with that on your own. So if we take a look at this particular command, we are trying to run arguments here. I see code 5. That means that's the image we're trying to take with that deck. So I will go from that front. Why I have to use the deck 5? Because currently the official MySQL image is running on version 8. It will not let you break most of your systems. So I said, say I want to get that image. These are a bunch of options that I will use to step up that image. So in this particular case, I want the machine name to be this. Worked last month with MySQL. Why this? We'll see later because Docker has internal networking that you will not have to make IP addresses or something. The whole networking thing is done inside Docker and you can use the names you define here. And yes, of course, don't do this even in development if your colleagues can access like MySQL. So that means the root will have absolutely no password. Everybody can see if your port is exposed on your local network on your machine. Everybody can access your address. So we will just run this and let it be there for a while. One important thing that really can help you is Docker PS MySQL. Why always use MySQL? Because then you will see the images that are even in a DOM state that I'm not trying to currently. But the containers that are out there. The Docker will not allow you to run the container twice. Even if you have the same name that container is put offline you will not be able to run it again in the same name you will receive never. So try to use a name and check the steps. That's the important part. Container ID it's important but I will more focus right now on names of the name of that container. To some more density stuff. Now I want without actually accessing the shell of that container to just execute the show databases in that running on that container. So around Docker exact this is the name of the container I want to access. And from here MySQL user and execute is actually my SQL command. Just basically my SQL command that you will use in the CLI. And of course I will get a result. So I didn't even access the shell for that container. I can run this from my host machine. All I need to know is the name or the ID of that container. That's why I explicitly put the name in because if I didn't to receive some generic name and then I will always have to use PS to list all the containers that are already in my database. It's much, much easier this way. So of course the idea behind this is after the third slide to have a running WordPress in Docker containers. So we want to create the database name WordPress. I will take that name specifically not just because it's a WordPress event but you will see later when we come to the WordPress image. And I just want to make sure that this works. So I'm running like after creating the database I want to confirm that I really have that database. So after running this command I will receive no result because that database is definitely empty. It still doesn't have nothing so it's perfectly normal. And just to confirm once again that I really have the database if I run the shell databases I will have my WordPress database listed. Keep in mind that I haven't used in the original command all the data that are stored for this machine will be available only inside that container. If container is deleted all the data that that container contains are also deleted. So if you don't have external mounting you will lose all your data in this particular case. Okay now we have a database we confirm that everything is fine on that end. So I want to try to set up a WordPress using just this few lines. So I want to run again the Docker container named Las Palmas WordPress and I want to link it to working on Las Palmas MySQL. The semicolon and MySQL afterwards defines that it will communicate on specific port for MySQL. This is the networking part that I mentioned. This is enough for the Docker that knows where to look for that container. It doesn't need an IP address. It will need an IP address of course. 1, 2, 7, 0.7, 0.7, 0.7 and it will automatically be assigned. But it's not something you actually need. You just need to remember the name and you can use it in your configuration. So like when you set a review of the file you simply put the name. You will not put the post or something like that. You use this name and the Docker knows exactly where to look for that container. Dash P is port. With this there is no this part. If we don't put the option this will return fault result that the connection was rejected. Why? Because I'm trying to access my local post on port AP that's basically not being exposed. So you can keep your port inside Docker. They will not be seen from outside but inside you can communicate with all the containers you have. Slash Demon, of course, won't run in the background so it will not shut down right after we has it in the command. And again we set up an image name which works. So one command here one command here and after that if we are on ES we see both our containers running. The result of the local post will as you can see be installed HP. Of course with some automation we can set up everything in just how much like I've been talking about this for the last 8 minutes to actually run all this you will need just about one minute and you will have your WordPress container fully running. You can test whatever you want fill it afterwards and that's it. No need to like we usually do it set up a VM then set up a database in a different VM if I want to keep all my databases in one place or I would set up my local my secret server, blah blah blah it takes much less time much less effort and it takes less time. And yes if you really like CLI it's really massive. So there is even faster way than this. So this wasn't the best one. We can use Docker Compose. It's again a CLI command that will take one file where you set all your containers in one config file similar like you will have for Composer or something like that. It's on structural, it's on documentation and uses pretty much the same things I don't know how much you can see actually enough. So again, I want to set up services. Those services are basically containers that will be created. I want this name and this name I want to use image MySQL 5.7 I could use 5 because it doesn't really matter. Volumes is something that I introduce here. That means that even when I drop this particular container the volume will still stay on until I explicitly remove the DB data volume or I remove the Docker altogether for my own machine. So this will override the issue that I mentioned before with using the just simple Docker run MySQL CLI command. In this case, the next time when I say I want to link my DB data to Barlin MySQL I will receive all the data that was stored there before. Unless, of course, I didn't explicitly remove it. Some environment variables and this will be the definition for MySQL container. Then we are jumping into the WordPress one. We say it depends on the DB one. This container is not up and running. This one will not try to start because it's pointless. It will just show an error and that's it. We will use the latest WordPress image and talking about images here on Docker Hub, both as MySQL and WordPress are official images. So that means they are being maintained by the companies behind the project. The least issue that's not been discovered before, and even if you discover a new issue, you can report to those companies. If you go with unofficial images, you will have to go back to developer that is working on Docker as well. Most of the time, you can ask and it meets that goal. Again, we are setting the connection for our WordPress vpconfig file where, yeah, there's a error here. I just hooked the DB. It should be vclaspalmos DB and running one port, of course, the 306. This will again bring you the same result as we had before, but just in one file. And the good thing about this, you can keep these files for project cloud. So let's say you're working on one project you will just do Docker compose up there. That's it. You will run a Docker file. You will push it in the upstate. You will get both of your this is up and running. You are finished with that project. You want to move to another one. Just do Docker compose down. It will bring down that one. It will bring up. Again, all this if you have images on your machine locally, it will take just a few seconds or maybe two or three seconds . When I first started working with Docker, it wasn't really production ready. But in the last year, year and a half really it got to a stage where you can say, okay, it's pretty stable. It will not create some weird issues where it will just all of a sudden go down, which used to happen before now it's not so much like you're just working on something and your container restarts. Why? No idea. It does. This is something we're working on in our company as a service for WordPress where we will use the set of containers for every client. It's pretty much like a shared posting, but in a different way. Docker also has some fancy features like limiting number of chords you can use for that container or limiting amount of memory you want to allow for that container to be used. But it has the better shelling option, so it's harder to get out if one WordPress site gets hacked. It's, I wouldn't say impossible, impossible in the IT, but it's really hard to reach to the others. Like even if you're running let's say Docker, it's a little bit better. So on the right I just listed some of the basic services that we will try to use and we are still experimenting how we can use one environment when it comes to VP includes for both clients. So we will just amount that on one place and your clients files on the second. And yeah, we were talking about containers for so long, like some containers that no one said it before. But yeah, pretty much this is like how your Docker host will work just, you will not have container, but actually you can because you can have all the containers of the same kinds that on top for some optimization if you want to let it into the community. What? How can I access later in Docker volumes? Depends where you put them. With this approach you will have to connect to that actual, to any container that has access to that volume, but you can use shared volumes where you will have that data on your host machine so you can easily just access that from your host machine. That's what I said it will be synced across. The synced process fails miserably on Windows. That's the few times it doesn't work. On Linux it works perfectly because you don't need an EM on OS 6. Maybe it works, maybe it doesn't. In most cases it works, but it can fail then just seriously install Docker and it will work. Any other question? Yeah? Okay, so. Thank you. I'm very curious and I need to sometimes just wanted to know which platform do you recommend for starting up making experiments with it? Which platform do you recommend for starting up making experiments with Docker? My setup is OS 6 with setup 7 in VM and then around not with but to my developers I usually recommend a dual boot if they are on Windows so like don't even go with the VM or on OS 6 you can easily go with Vagrant and that works. At least in my experience it worked with no problems. Okay, any other question? Well, let's give an applause to