 Hello, this is Christian. In this video, I want to show you how to create an instance of the SQL server on your Macintosh using Docker. Then I'll show you also how to connect to that SQL server using a program called SQL Operations Studio. Then next, I'll show you how to connect to a database. Actually, we're going to attach a database called AdventureWorks 2016 to that instance. And then just in case that we need to reinstall or reboot that instance, we need to do that as well. So I'll show you how to do that in step six. So first things first, make sure that Docker is installed and running. Let me go ahead and read my little thing here first. So as you can see, the little symbol here on my Mac, I have a Docker for desktop is running. It's a really lightweight version only. So it's running here right now. You can also check your terminal. Make sure it's running by clicking the terminal. And in here, just type Docker dash v to show you the version it's working or not. And then if you want to check, if you have any instances running, type in Docker space ps. And then we'll list all the instances right at this point. As you can see, I don't have anything here. So it's blank. If you want to see all the previous versions or containers, you can do ps and then dash a for all. Can you show this all here as well? I pretty much removed everything. So I started from fresh, very clean. So you can see that it is nothing here. So the first thing we need to do is we need to create this instance. And this is how you do it. So I put a note here. You only do this once, unless you want to create multiple versions or multiple instances of SQL Server, then you do that. Because each time you create, Docker will create a unique container ID for that instance. And that instance of that ID will exist there until you delete Docker or until you remove them and so forth. So I'll show you how and where those are. So first, I'm going to copy the slides with a long line of code to run. So just copy that. And we're going to paste it into the terminal here. I'm going to just paste it right in here. And just make sure that this is a single line, a single statement. If it's not, it may not work so. So just hit Enter. And then you see it's really quick. So that's done. And now if we go back and we type in Docker PS, you will see that now that container has been created. It's a really long list. So you can see that the line actually wraps here. I can't see everything here. But the very first thing you see here is the container ID. So this ID here is referring to this ID right here. It's a don't know how many characters, but it's quite long. So that ID is created and at the port number here and so on. So if you want to create it again, for example, I can go up again. And I just create again. Let me go and see if it lets me or not, I'm not sure. So it tells me that I want to use in port 1, 3, 4, 3, 3. So I can't use it again. So you can only run one at the same time using the same port number unless you change it. But let me do something real quick here. Again, I'm going to show you Docker PS. So that's working for now. So we'll keep that for now. I'll do that afterwards. So that's good. And the status is up and running. It's up here and running. So now the next thing we need to do is go ahead and run the, well, we can go and download the eventual works first. That's on Blackboard. So if you go here to Blackboard and basically just go to the assignment 1 and download to your machine. OK, so you go here. That's in here under the apply or to do. So I'm going to download this 2016, you know, dot BAK. And if you just right click on it and save link as, or just click download. And it should download to your downloads folder. So in my example, I put inside my downloads folder. You can see that I downloaded here. This is the one I'm going to need. OK, so once that's been downloaded, we need to do the following. We need to go back to my notes. OK, we need to copy this eventual works to the Docker container because the Docker container is a virtual machine, right? So that you need to copy this database to that container. And we needed to copy to this location right here. OK, so the Docker will look something like that. And also, you need to know the container ID, right? The ID that this Docker created for you. This ID right here is this ID right here. We need to replace this with that ID and basically copy that to the virtual machine. And so I want to show you where this is and why is it important. OK, so to do that, let's run the SQL operations studio and let's connect to that studio first. So if you don't have any connection, I'm going to add a new connection. After that, you should see it's here. So some of the other ones are already here. But anyway, so the server name is just localhost. User name is S-A. The password is the one I created. So mine is like my GTC 123 dollar sign. OK, so it's case sensitive. Make sure that it's crooked type and then just click connect. Hopefully everything goes good. So now we're connected. And then you will see that if you don't see this screen right here, OK, if you don't see it, I will show you where it is. So let's say that you don't see it. You only see something like that. You can double click on this localhost here. If you double click on it, this page should load. If you still don't see it, you can just right click on it and go to manage. OK, and then so here on this screen, you will see that the system databases are here. We don't have eventual works yet. If you do see it, it should be listed right here. So now we need to go and restore that database. So you click on here to restore. And then here on the restore from I want to pick the one is this backup file. That's the dot BAK. And from the path is, as you can see, if you navigate here, you see that all these bind these links in here, these are links or directories inside that container only. This is not on your Macintosh. It's in the Docker container. OK, so we need to copy that. Eventually works to the var directory inside the OPT directory and SSQL directory inside data. OK, so basically this link right here. That's you want to put it, which is why in my notes, we need to copy that to that location. Let's go to Docker terminal here and scroll up or do the Docker PS and then find this ID right here. OK, you need to copy this ID. So just select that, copy it, and then paste it right in here. OK, I'll paste it right in here and make sure it looks like that. The colon isn't here. OK, it's important. And then now we just copy this whole command, copy it. And then we go to the terminal. And then right here, we're going to paste it right in here. OK, so here is the command. Copy the eventual works from the downloads directory. If you move it to a different place, make sure you put it into that location. But my example is coming from the downloads directory. I'm going to copy it over to this container. OK, add this location in the data directory and hit Enter. OK, so that shouldn't take long. Now we're done. Now if you go back to the studio, and if it's not here yet, you can just go back again and then try again. Hopefully, it will show up in there. OK, so now you see that the database has been copied over to the data directory. So we just need to select that database and click OK. And it should do its magic here. And then finally, we're just going to click Restore. OK, Restore. And if it's successful, it's running over here. It's still doing its thing. And we should have access to that database from there. No one. So here we are. We're going to go. And if it's not shown here yet, you can try to reload or something. If it's not loaded here, you can close this screen here, exit out, and then just go to the server database here. And you should now see eventual works being done. The eventual works being installed attached to your database. So now we're good to go. All right? So now let's say that I'm going to turn off my laptop. So once you turn off your laptop or your program, or if you turn off a docker, if you quit docker, for example, if I quit docker, OK, once that's off, I'm going to turn on my terminal here as well. And then I'm going to go in and rerun my docker again, when I quit it. I didn't put it in the thing. It's my applications. I should have put it. So here is the docker edge I used. I'm going to double click to run that again. It's still doing it. It's still running. And so while that's still booting, I'm going to go ahead and click the terminal. And see, is it done? OK, that's good. So now if I type in docker again, you see that now the instance is gone. It's not active anymore. And if you try to connect to that instance through the SQL server, it's not going to be able to find it. So it's not going to work like SQL server is not there. It's trying to connect. It's going to fail, right? So here again, if I go and connect, you should not find it. So you have a connection here. So now if I type in docker ps-a, and you will see that I have instances created earlier. So this is the one that I created. Actually, there are two of them. But the one that I created that we added, the eventual works too, was this ID here. So you just have to remember which ID you use to activate it. So right now it says it's exited. I mean, we quit that already about 10 minutes ago or so it says. So I'm going to go and restart this again. So you just have to remember this ID. So if you copy this ID here to memory, and then I'm going to do here docker restart, and then paste in that ID and hit Enter. Now that docker container should be active now. So here we go. It's active again. And then now I'm going to go back to SQL Server Studio over here and reconnect again. So you see that now I'm able to connect it back. And my database is everything here is still retained. So if you don't remember that ID, or if you happen to delete it and it's gone, then you have to start the whole process again, recreate a container, and then copy that over again to this container, and then connect it to your database system that way. So that's what you need to do in order to use the eventual works again. Thank you.