Run AI Models Locally: Zero API Keys, Zero Fees with Docker Desktop Model Runner — Transcript
Full transcript
- 0:00Hey developers, tired of sending your
- 0:02data to the cloud APIs just to use AI in
- 0:05your applications? What if you could run
- 0:07powerful AI models right on your Mac
- 0:09with zero API keys, zero data sharing,
- 0:12and zero monthly fees? Today, I'm going
- 0:15to show you how Docker Desktop's new
- 0:17model runner feature lets you run AI
- 0:20models locally and how to integrate them
- 0:22with your Spring Boot applications using
- 0:24Spring AI. In just 15 minutes, you have
- 0:27a fully functional AI powered Java
- 0:29application running completely on your
- 0:32own
- 0:34machine. So here I am over on the docker
- 0:38model runner uh documentation. Uh this
- 0:41is a new feature for Docker Desktop. You
- 0:43can see here that it requires Docker
- 0:45Desktop 4.40 and later. And I think this
- 0:49is only for Docker Desktop with Mac and
- 0:52Apple silicone at the time. I believe
- 0:55this will uh branch out into other
- 0:57platforms later on. So the Docker model
- 1:00runner plugin lets you pull models from
- 1:03DockerHub. So you can run open- source
- 1:05models. You can run AI models directly
- 1:08from the command line. You can manage
- 1:10local models. You can add new ones, list
- 1:12them, remove them, interact with models
- 1:15using a submitted prompt or in a chat
- 1:17mode. So this is very similar to
- 1:20something like I've covered in the past.
- 1:22If you want, I'll leave a link in the
- 1:24description below. Uh, but this is a new
- 1:27feature from Docker. I saw this
- 1:28announced at Java 1. I was really
- 1:30excited about this. Another way to kind
- 1:32of interact with local models. So once
- 1:36you have it running, um, once you have
- 1:38it installed, you can do a couple of
- 1:40things. You can check the model status.
- 1:42You can run help, which will give you a
- 1:44bunch of commands that you can run. So
- 1:46if you want to list the models that
- 1:47you've already installed locally, if you
- 1:49want to pull a new one down from Docker
- 1:51Hub, you can. You can remove, you can
- 1:54run status and version. So here's where
- 1:57it starts. Um, we'll go into Docker
- 1:59Desktop. I'll show you this in a second,
- 2:00but I just want to go through the
- 2:02documentation first. So you docker model
- 2:05pull and then pull a specific model that
- 2:07you want to use. Today I'm going to use
- 2:09Google Gemini's Gemma 3, which is their
- 2:11open- source model. uh I've been finding
- 2:13it uh really useful uh for testing on my
- 2:16local machine. And so you'll say docker
- 2:19model pull and then AI and then the name
- 2:21of the model. Once it's done, it's
- 2:24available to use. You can use it right
- 2:25in the terminal on your machine and and
- 2:28chat with it interactively and do some
- 2:31things there. But then there's also a
- 2:32way that we can use it in our
- 2:34applications.
- 2:36So if you ever want to see which ones
- 2:38you have available, you can list um you
- 2:40can run a particular model and then uh
- 2:43it goes into some other things. The big
- 2:46thing here is that if you want to
- 2:48integrate it into say an AI application
- 2:50that we're building using something like
- 2:52Java and Spring, then you'll need to
- 2:54make sure that there is a feature
- 2:57toggled on for making TCP available.
- 3:00Once you do that, it exposes a localhost
- 3:04um network over HTTP and you can do a
- 3:08bunch of things to it like you can get a
- 3:10list of engines, you can do some other
- 3:12things with it. So um that's the
- 3:15documentation and then uh you can
- 3:18interact with it through the OpenAI API.
- 3:21So in Java and in Spring AI, we'll use
- 3:23the OpenAI API and we'll talk to it just
- 3:26like we would uh OpenAI's
- 3:31GPT40. So that's the documentation. I'll
- 3:34leave a link to that in the description
- 3:36below. Uh but with that, let's take a
- 3:38look at Docker Desktop. Uh we'll see
- 3:40what we need to configure there and then
- 3:42we'll go ahead and take a look at how to
- 3:44pull a model. And um oh before we do
- 3:47that, I want to look at one more thing.
- 3:49So if you're using something like Olama,
- 3:52there's a list of models that are
- 3:54available. The same thing is here. So
- 3:56what models are available? You can open
- 3:57up this link and you can see the
- 3:59different models. So there's uh Llama
- 4:023.3 um and so on. So I'm going to use
- 4:06Gemma. So if you go down here, you can
- 4:08see Gemma 3. There are some different
- 4:11flavors of it, but it gives you the
- 4:12command here. So Docker model pool AI
- 4:14Gemma 3. So you can copy that if you
- 4:16want. And then uh there are a couple
- 4:19different models here. One is 7.7 GB,
- 4:22one is 2.5 GB, and I believe I just
- 4:25installed this. So if you say pull AI
- 4:28Gemma 3, it's going to pull the latest,
- 4:30which is this one. If you want the
- 4:32larger one, uh then you'll want to be
- 4:34specific and give it that as a
- 4:37parameter. Cool. So with that, let's
- 4:39head over to the desktop and take a look
- 4:41at Docker Desktop. All right. So once
- 4:43you have the correct version of Docker
- 4:45Desktop installed, you want to go up to
- 4:47settings and down to our uh features and
- 4:51development. And this is where it says
- 4:53enable docker model runner. And you'll
- 4:56want to make sure that this check box is
- 4:59checked. So enable host side TCP
- 5:01support. I'm going to leave it on the
- 5:03default port of 1 2 4 3 4. With that,
- 5:06you have everything you need to get up
- 5:08and running. So again, you can go here
- 5:10and say dock docker model list and it
- 5:14will list out all of the uh available
- 5:16models that you have pulled. Now I went
- 5:18ahead and pulled down that Gemma 3 model
- 5:20just so we didn't have to wait for me to
- 5:22install it. But if you wanted to
- 5:24yourself, you can say docker model pull
- 5:27uh and then the name of the model that
- 5:29you want to pull down. But because I
- 5:31already have that running, I can go
- 5:32ahead and say docker model run and give
- 5:35it that name. So AI Gemma 3. And now I
- 5:38can interact with it locally uh in my
- 5:40terminal. So I can say what is an
- 5:44interesting fact about Docker and we'll
- 5:48see this and it will come back and we
- 5:50get that nice streaming response. So
- 5:52similar to how we would with something
- 5:54like chat GBT, we get this nice kind of
- 5:56conversational um text window that we
- 5:59can just kind of chat back and forth
- 6:01with. Again, the important thing to
- 6:03remember here is now that we are running
- 6:05a model locally on our machine to be
- 6:08able to do this and we are not paying
- 6:10for this. We are not sending our data to
- 6:12the cloud. Uh this is all running on my
- 6:15on my machine and running pretty fast, I
- 6:17might add. So, um I don't know how it
- 6:21says this works with Docker or Apple Mac
- 6:25silicone. So, I'm running an M4 pretty
- 6:28decent machine. So that's why I'm
- 6:30probably getting some pretty good
- 6:32performance out of this. Um, but I'd be
- 6:34curious if anyone anybody's running uh
- 6:36something else, let me know how the
- 6:38performance is for you. So that is um
- 6:42running. With that running, uh we can go
- 6:45ahead and create an app to talk to this
- 6:46model locally. All right. So I do have a
- 6:48GitHub repo here under docker model
- 6:51runner. Uh this has all the explanation
- 6:53on how to get up and running with this.
- 6:55Basically what we're going to do here
- 6:56today. Uh but I'll walk you through
- 6:58that. So, I'm going to go over to
- 7:01start.spring.io, pick the latest version
- 7:03of Spring Boot. I'm going to call this
- 7:05dev.dan Vega. We'll call this Docker
- 7:08Model Runner. And I'll put this in a
- 7:12package called Docker. So, I'm going to
- 7:14pick a couple of dependencies here. I'm
- 7:16going to choose web and then I'm going
- 7:18to choose OpenAI because again, this is
- 7:21OpenAI compatible. So, this will work
- 7:23with that. That's all of the settings or
- 7:26all of the dependencies that we need. We
- 7:28can go ahead and click generate. This
- 7:29will download a zip file. You can open
- 7:31up this in whatever ID or text editor
- 7:34you're most productive in. For me,
- 7:36that's going to be Intelligj. But with
- 7:37that, I think we have everything we
- 7:39need. So, let's write some code. All
- 7:40right. So, here I am in my application.
- 7:43Uh, the first thing I need to do is set
- 7:44up a couple of properties. Whenever
- 7:46you're working with a large language
- 7:47model here in Spring AI, you need to
- 7:49define a couple of properties. Now, the
- 7:51first one is the Open AI API key. We
- 7:55actually don't need an API key because
- 7:57we are not talking to OpenAI. We are
- 7:59talking to a local model. But uh Spring
- 8:02AI requires an OpenAI key when you're
- 8:04using the OpenAI Spring Boot starter. So
- 8:07I'm just going to put in an empty API
- 8:09key. We don't actually need one here. Uh
- 8:11then I'm going to go ahead and set the
- 8:14base URL. So this is going to be because
- 8:17we uh enabled that TCP option in Docker
- 8:20Desktop. We are going to have something
- 8:23running on localhost one two uh what was
- 8:26it? Uh 434 I believe. Yes. And then uh
- 8:30the base URL for this is going to be
- 8:32engines
- 8:35llama.cpp. Now the other thing is there
- 8:38is a completions path. This is what it
- 8:41looks like. I'm not going to enable that
- 8:43because we are not changing that. This
- 8:44is what we need. So this plus the base
- 8:47URL is the full URL to uh the API path.
- 8:52Uh with that we also need one more. We
- 8:53got to define the model that we're using
- 8:55because again with docker model runner
- 8:57we could be using one of num a number of
- 8:59models. So here we're going to define
- 9:02the model that we're using as AI Gemma
- 9:053. All right with that we have
- 9:07everything we need to go ahead and write
- 9:09some code. I'm going to keep this pretty
- 9:11simple today. I'm going to do this right
- 9:14in my application class. I'm going to
- 9:16create a new bean of type command line
- 9:18runner. Command line runner. And we are
- 9:21going to pull in the chat client. So if
- 9:24you're new to Spring AI, you can check
- 9:25out a lot of videos on my channel about
- 9:27this. But the chat client is basically
- 9:30the abstraction to talk to whatever
- 9:34model we've configured. So we've
- 9:36configured Gemma 3 underneath the hood.
- 9:38But the nice thing about this is this
- 9:40chat client is going to be kind of
- 9:42universal, right? Like we don't need to
- 9:44change code based on whatever model
- 9:46we're talking to. So now I can use that
- 9:48builder and build a new client. I'm
- 9:50going to call this client. And then I
- 9:53can use the client to send a prompt. So
- 9:56I'm going to say
- 9:58client.prompt. And in that prompt, I'm
- 10:00going to ask a similar question. Um,
- 10:02something like when was Docker created?
- 10:07And then we can go ahead and make a call
- 10:09to it. This is a blocking call. If you
- 10:11wanted to do a streaming call, you
- 10:12could. Uh, but this will be just fine
- 10:15for this example. And then what I want
- 10:17to get back is just the response. I just
- 10:19want that string response that comes
- 10:21back. I'll create a variable from this
- 10:23called response. And then I'll go ahead
- 10:25and output the response. So with that,
- 10:28that is all we need to get up and
- 10:30running. Hopefully this uh works. Let's
- 10:32go ahead and give it a try. And if we
- 10:34run this, this will execute after the
- 10:38application context has uh started up.
- 10:41And we do have an error here. But that's
- 10:43okay. This is fun. Let's figure out
- 10:45what's going on together here and see if
- 10:48we can't figure this out.
- 10:50Um, so we are sending this to so I uh
- 10:56post for request. Um, null. Oh, and it
- 11:00looks like I have a typo here. That
- 11:03would definitely do it. Let's go ahead
- 11:05and fix
- 11:07that. And it looks like it's running. So
- 11:10here, Docker was officially created in
- 11:12July of 2013. Here's a breakdown of the
- 11:16key
- 11:17milestones. So that's awesome. We were
- 11:19able to use Docker Desktop's new um
- 11:23Docker model runner and we were able to
- 11:26pull in a local open-source free model
- 11:31that we can use right on our laptops.
- 11:33This is really great because we don't
- 11:34have to have any API keys. We don't
- 11:36occur any monthly billing. We just kind
- 11:39of get to test some things out locally.
- 11:41And again, uh we could take these models
- 11:44to production. So if you wanted to host
- 11:46these models uh within your
- 11:48organization, you could as well. Uh but
- 11:51for me as a developer, this is really
- 11:53great to be able to kind of test this
- 11:55stuff out locally and using a tool that
- 11:57I love to use, which is Docker Desktop.
- 11:59So I hope you found this useful. I'm
- 12:01really excited for this new feature and
- 12:03taking a look at their road map and
- 12:04seeing what they're they're interested
- 12:06in in putting together on this. I think
- 12:08this is a great alternative to a llama.
- 12:11Uh so hopefully you do, too. And
- 12:14hopefully you learned something new
- 12:15today. I I had a lot of fun putting this
- 12:16together. If you learned something new
- 12:18today, do me a big favor. Leave me a
- 12:20thumbs up, subscribe to the channel, and
- 12:23as always, happy coding, friends.
- 12:26[Music]
About this transcript
This page contains the full transcript of Run AI Models Locally: Zero API Keys, Zero Fees with Docker Desktop Model Runner by Dan Vega, generated from the public captions YouTube serves with the video. The transcript has 2,315 words across 311 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.