Latest / Talk Python To Me / #9: Docker for the Python Developer
Transcript
- 0:00It's time to jump into the brave new world of containers and Docker with Patrick Shanizen.
- 0:05This is Talk Python To Me, episode number nine, recorded Monday, May 4th, 2015.
- 0:10Hello.
- 0:40And welcome to Talk Python To Me, a weekly podcast on Python, the language, the libraries,
- 0:46the ecosystem, and the personalities.
- 0:48This is your host, Michael Kennedy.
- 0:50Follow me on Twitter, where I'm @mkennedy, and keep up with the show and listen to past
- 0:54episodes at talkpythontome.com.
- 0:57This episode, we'll be talking with Patrick Shanizen about Docker.
- 1:01Before we get to Patrick, I'm really excited to tell you that this episode is brought to
- 1:05you by Codeship.
- 1:06Codeship is a platform for continuous integration and continuous delivery as a service.
- 1:11Please take a moment to check them out at codeship.com or follow them on Twitter, where they're
- 1:16at Codeship.
- 1:17Now, let me introduce Patrick.
- 1:18Patrick Shanizen is a member of the technical staff at Docker Inc.
- 1:22He helps build Docker, an open platform for distributed applications for developers and sysadmins.
- 1:28Patrick is a software developer and storyteller.
- 1:31He has spent 10 years building platforms at Netscape and Sun, 10 more evangelizing platforms
- 1:36at Google, VMware, and Microsoft.
- 1:39His main professional interest is in building and kickstarting the network effects for these
- 1:44wondrous two-sided markets called platforms.
- 1:46He worked on platforms for portals, ads, commerce, social, web, distributed apps, and of course,
- 1:53the cloud.
- 1:53Patrick, welcome to the show.
- 1:56Hey, Michael.
- 1:57Thanks for having me.
- 1:58Hey, I'm really glad that you're here, and I'm super excited to have Docker on the show.
- 2:04Ever since I learned about Docker, there's a few times I've learned about some technology,
- 2:09and it has completely taken over me, and somehow I'm obsessed to learn it.
- 2:14And when I figured, when I came across Docker, when you guys announced it, I don't know, was
- 2:19it a year ago?
- 2:20Two years, about two years ago, right?
- 2:22Yeah, I came across it, and I'm just, oh my gosh, I need to learn this.
- 2:27I need to understand this, because this is going to be huge.
- 2:29And I really think Docker and these container technologies are going to change the way we
- 2:34build and deliver software.
- 2:36So let's start with telling the world, what is Docker, for those who don't know?
- 2:41Sure.
- 2:42So Docker is an open source project that was announced by Solomon Haidt, the founder of
- 2:50.cloud and Docker, two years ago at PyCon.
- 2:53So it's relevant for Python developers, because it all started at PyCon.
- 2:59And so Solomon and his team were building this platform as a service called .cloud, and they
- 3:06were struggling with that option.
- 3:08It's a time when, at that time I was at Google, I was doing a Google App Engine.
- 3:13There was Heroku, who's been bought by Salesforce.
- 3:17And so .cloud had trouble attracting developers to their platform as a service, which allowed
- 3:23you to deploy applications in PHP, Python, and multiple languages.
- 3:28Well, at the time, a platform like Google App Engine, for example, was limited to Python
- 3:33and Java as runtimes, and Go as well.
- 3:37And so they were struggling with adoption, but they had this gem inside of .cloud that they
- 3:43were using to build their platform as a service that was called Docker.
- 3:49And that was an easy way to package and distribute, build, ship, and run Linux containers.
- 3:58And so they open-sourced the project at PyCon two years ago.
- 4:03And then it took the world by storm.
- 4:05Like all developers starting adopting it.
- 4:08And the whole industry restructured around that notion of Linux container.
- 4:14So Docker essentially is a set of tools that allow you to build, ship, and run distributed applications based on Linux containers.
- 4:25So there's the Docker command line, which is at the same time, it's a unique binary that has a client and a daemon.
- 4:34And the daemon lets you get images for containers on your local machine or on a server and run them in a Linux container, like isolated from other workloads on that machine.
- 4:49So you can have your own file system, your own users, your own network namespace.
- 4:54And so Docker is based on Linux namespaces and C groups.
- 4:59And then you have Docker machine that lets you provision machines running the Docker engine on any cloud provider, like Google, Amazon, Microsoft, but also locally on your machine on VMware, VirtualBox, or Hyper-V.
- 5:17So Docker itself, Docker machine to provision the machines.
- 5:23Then there's another project called Docker Compose that allows you to assemble all these containers that you're using to build your microservices into a single unit that you can run on your laptop for development or ship to the cloud as a single unit.
- 5:41So typically you would have, for your typical Python app, maybe you're using Django or Flask.
- 5:47You would have one container that has Django, your Django application with its code in it.
- 5:53And you would link that to another container that has Redis on MySQL.
- 5:57And then you can start all this with a single command, Docker Compose.
- 6:03So you can, with Docker Compose, you can just start.
- 6:06Yes, exactly.
- 6:07So in Docker Compose, you say, I have my image for my Django app.
- 6:12Let's call it like, let's call it like, my Django app.
- 6:18I want to launch that with port 80 on the machine, on the server on which it's running, mapped to port 8080, maybe internally, where I'm running it.
- 6:28And then I want to tie that to a Redis instance that's using the Docker image Redis that's on Docker Hub.
- 6:35And then inside of my code, I'm just going to refer to Redis and automatically it will just tie that to the other container that's running.
- 6:53CodeChip is a hosted continuous delivery service focused on speed, security, and customizability.
- 6:59You can set up continuous integration in a matter of seconds and automatically deploy when your tests have passed.
- 7:05CodeChip supports your GitHub and Bitbucket projects.
- 7:08You can get started with CodeChip's free plan today.
- 7:11Should you decide to go with a premium plan, Talk Python listeners can save 20% off any plan for the next three months by using the code TALKPython.
- 7:19All caps, no spaces.
- 7:22Check them out at CodeChip.com and tell them thanks for sponsoring the show on Twitter where they're at CodeChip.
- 7:29So before we get into the details of how we run all that, you know, it's interesting that Docker kind of grew out of what was supposed to be kind of a larger project, right?
- 7:48Yeah.
- 7:48A platform as a service company, if you will.
- 7:50It was just, it was just, that was how you guys were trying to internally achieve greater density for your hosting.
- 7:55Yeah, that's exactly right.
- 7:57And the notion of running Linux containers has been around for a really long time.
- 8:03Or actually containers themselves have been around for a long time with three BSD gels.
- 8:10In the, like, 2005, there was already the notion of Solaris containers in Solaris.
- 8:18So that notion of containers existing for a long time.
- 8:21And that's the way Google is running its workloads inside of Google data centers, using Linux containers for isolation in order to be able to run workloads with a very high density,
- 8:36because it's using Linux or operating system virtualization.
- 8:43So that's a super important difference or distinction to make between these containers and virtual machines.
- 8:53So if I create a virtual machine, maybe it's a couple of gigs for the file system and the operating system and all my data and everything I've done to it.
- 9:02Maybe it uses two gigs of RAM when I start and stop it.
- 9:05It's got to boot up like a regular machine.
- 9:07You know, it's a big blocky thing.
- 9:10How big are these Docker containers?
- 9:11Yeah, they can.
- 9:12So Docker containers compared to virtual machines can be much smaller.
- 9:16They can be big as well, but usually they're much smaller.
- 9:22And another advantage they have over VMs is that the image format for Docker images, they are layered.
- 9:32So you build a layer, you can say, oh, I'm going to inherit from the Ubuntu layer, and then I'm going to install Python on that.
- 9:41And then I'm going to use pip to install my requirements on that.
- 9:45Each of these instructions generates a different layer, and when you're using the Docker pool to pull the image or Docker run to run that image,
- 9:55what it's doing is that it's looking in its local cache to see, oh, hey, I have Ubuntu already in there.
- 10:02So I'm just going to download the image that adds Python to it and then the one with the requirements for my app.
- 10:09So there's an additional density in terms of storage as well that goes with it.
- 10:15While when you're packaging your app for a VM, you're just building that monolithic VM image with everything from the version of Linux or Windows that you're running in there,
- 10:26the full operating system, plus your application code and packaging, and every VM you start has all these data.
- 10:35While if you're running like 10 different Python applications package as a container on one host,
- 10:43you would have one time the data for the Ubuntu VM, that's your base, and then maybe one layer for Python,
- 10:53and then small layers 10 times for the requirements and the code base for your Python application.
- 11:00So the images are lighter.
- 11:02And what that means is that they download much faster.
- 11:05Another aspect is that at runtime, it's much faster.
- 11:09So starting a container, once your image is cached locally, just take like a few milliseconds.
- 11:15While, as you know, to start a VM, it takes a good 20 to 30 seconds in good cases.
- 11:24Yeah, that's really amazing.
- 11:25And I like the layering concept.
- 11:28So every layer you add brings you closer and closer to the specific type of operating system and environment you need for your app.
- 11:36So at first, it's just Linux, and that could be anything.
- 11:40Yeah.
- 11:40And then it's Linux plus your version of Python.
- 11:43And so it's a little closer.
- 11:44And then maybe it's that plus Nginx.
- 11:47And then it's a little closer.
- 11:49And then it's that version of Linux plus Python plus Nginx plus all the packages your web app depends upon.
- 11:56And then finally, maybe it's your code.
- 11:57And so you can use every one of those layers as a building block to create new ones and things like that, right?
- 12:04Yeah, it's very composable.
- 12:05So once you have created your base layer, anybody in your team or if you make it public on Docker Hub can inherit from that and add their own stuff.
- 12:17Or you can go up in the chain of inheritance of layers and say, oh, I don't like the official Python layer.
- 12:27I'm going to see what operating system they're using to run it, and maybe I'm going to create my own.
- 12:33So you can branch off at any time.
- 12:35It's a very flexible system that gives you total flexibility.
- 12:39And at the same time, to me, the big differentiation is that the speed aspect to it, the fact that downloading images is much faster because images are layered.
- 12:53And starting a container is like 10 times or maybe 100 times faster, depending on the cases.
- 13:00When you make things faster, usually it changes the experience.
- 13:04And that's what developers found or realized when they start.
- 13:10When a developer starts to use Docker, usually they have this aha moment.
- 13:13Oh, then I can build all the time and create my own images and start breaking my application that was monolithic into smaller microservices that are easier to compose with something like Docker Compose.
- 13:26So it goes hand in hand with two big shifts in software engineering that happened in the past five years.
- 13:37One of them is microservices.
- 13:38One of them is microservices, the fact of breaking up your application into smaller services that can be scaled and developed independently.
- 13:47And the other one is DevOps, where dev teams and ops teams are working together with continuous integration and continuous delivery using the same tools to achieve continuous delivery of their application.
- 14:05And so the container is a really nice unit of collaboration between devs and ops.
- 14:09I think you're right that the size makes that really even possible to some degree.
- 14:16So let me give you my mental model for the DevOps story.
- 14:20And maybe you can tell me how I have that slightly wrong or improve on it or whatever.
- 14:24So in my mind, I'm thinking there's some developers building their app and probably they have some kind of continuous integration set up where they check in, some automated build happens, some test run, stuff like that.
- 14:35So I could build instead of just running my code directly, checking in and running my test directly on the, say, the build server.
- 14:41I could create a container.
- 14:42And when I do a check in, the build server could actually create one of these containers, push my code into it, run that code in that actual container environment.
- 14:52And if I'm happy, maybe I could automatically push that out to some cloud provider.
- 14:57And the thing that's actually running is the thing I tested and built locally.
- 15:02Yeah.
- 15:04So there's no sort of environmental differences or anything like that.
- 15:08It's just that is the thing.
- 15:09I can actually ship almost the infrastructure.
- 15:11Yeah.
- 15:11I think you got it right.
- 15:13One of the things I would add is that this kind of factoring out of applications into microservices works really well for people who follow the 12-factor app manifesto that Heroku published a few years ago
- 15:31where you try to build your apps as stateless as possible.
- 15:35You run data services in a centralized way.
- 15:38And then you configure the connectivity between different microservices with environment variables.
- 15:47And so typically what would happen is that you would run locally as a developer on a single box with a test MySQL container
- 15:57that has a volume attached with test data in there.
- 16:01And then when you just got pushed to a build server, the build server deploys that into a cloud QA environment where automated tests are deployed.
- 16:13And then there the container would be tied to a test MySQL database that maybe is maintained by operations.
- 16:21So this is where the split between dev and operations happens where the devs specify all the requirements that they have for their app in the container.
- 16:31And then the ops are providing the right plugs to the right services in different environments.
- 16:37And then eventually you would push that to production where typically there would be someone, a sysadmin, that would decide, hey, this build is ready to go to production.
- 16:50I'm just going to trigger the fact that in production the image is going to be pulled.
- 16:56It's the same image that I had on my dev box.
- 16:59But there it's configured to go to my production MySQL cluster.
- 17:03That's really amazing.
- 17:07So how do I deal with persistent data?
- 17:11You know, I've got this.
- 17:12Let's say I create one of these Docker containers that contains like MongoDB.
- 17:18MongoDB has to have a data store somewhere on the file system.
- 17:22How do I kind of deal with inversion that?
- 17:25Is that actually in the container?
- 17:26Is that somewhere else?
- 17:28How do I, you know, if the database schema changes as the new container comes up, what do I do?
- 17:34That seems a little tricky.
- 17:35Yeah, yeah, yeah.
- 17:36Definitely.
- 17:36So Docker has this notion of values where in your container you can mount a directory that is on your host machine.
- 17:47And this is where you would keep the data.
- 17:49And typically there's also another notion that is called a data container where you just launch a container that just has a volume attached to it.
- 18:00And then you mount the volumes from that container into your runtime container.
- 18:07And then changing database like from development to production would just be a matter of changing the volume of the container you're mounting your volume from.
- 18:18So that's the notion of volume that lets you have persistent containers.
- 18:24There's one issue with it in Docker today that lots of people are running into when they try to deploy in clusters, which is volumes can be attached only for local file systems, on the engine on which you are triggered, on the host on which you are triggered.
- 18:42And there's a company called cluster HQ, which is building an add-on to Docker called Fluckr.
- 18:49We're working with them to make it a plugin, like a real plugin in Docker.
- 18:55So there's work underway to make that happen right now.
- 18:59And what Fluckr is doing is that they're addressing this issue of moving persistent container from one host to another.
- 19:06If you're deploying in a large orchestrated Docker setup, where when the orchestrator tells the engine, hey, I want to move that Docker engine that is tied to your,
- 19:20Docker container that has a persistent volume from host A to host B, what they're doing is that they're using ZFS under the hood,
- 19:31and they're doing a ZFS snapshot, which are pretty fast.
- 19:34Then they're moving the snapshot to the other machine that can take a few hours.
- 19:38And once the snapshot is moved, they can start your server, take a diff of the snapshot and push it on the other side, which is faster.
- 19:47And then they restart your container on the other side.
- 19:50That sounds really helpful because it seems like there's a lot of complexity, more and more containers that get involved,
- 19:54a more horizontal scale that gets in there.
- 19:56Yeah.
- 19:56Yeah.
- 19:57Container persistence is really an interesting issue where there's lots of research right now and lots of companies looking into that and how to enable this.
- 20:05Excellent.
- 20:06So you've spoken a little bit about Docker Hub.
- 20:08Can you tell the listeners what that is?
- 20:10Yeah, definitely.
- 20:11So Docker itself is a client and a demon that's running either on your local machine or on your server.
- 20:19But what you're building with the Docker client is an image of the system on which you're running.
- 20:26Once your image is ready, typically you would push it to Docker Hub, which is a hosted service by Docker.
- 20:32So it's software as a service.
- 20:34It's a hosted service that Docker, that lets you share your images either with the world.
- 20:41You can make your image public.
- 20:42You can make your image public.
- 20:42And there are lots of open source and community images in there.
- 20:47Or you can host them privately.
- 20:50So Docker Hub is free for public images.
- 20:54But if you want a private image, you can buy a subscription that allows you to have several private images for your own projects.
- 21:03And then your colleague can just download the images from the hub as well.
- 21:08And it's integrated with Docker client.
- 21:10We also have a version that's called Docker Hub Enterprise.
- 21:14That enterprises who want to adopt Docker for their internal workflow can install behind the firewall.
- 21:20So they have complete control over the policies for the images that they're creating.
- 21:25Right.
- 21:25That makes sense.
- 21:26You might not want to just go grab a bunch of public images and download them.
- 21:29Is this actual source code or actual binary executables that I'm grabbing?
- 21:34Or is there another way to get an image from Docker Hub?
- 21:37So what you grab from Docker Hub, these images are actually tables that are gzip for each of the layers with a bunch of metadata explaining the Docker Engine how to reconstitute the image of your operating system.
- 21:53Okay, excellent.
- 21:54So it might tell me how to install Nginx or how to install Python 3 or something like that.
- 21:58Yeah, exactly.
- 21:59So we host official Docker images for many open source projects.
- 22:05So for example, for Python, there's an excellent...
- 22:08I used to take images from the community initially.
- 22:11And then I switched to the official image, which is called Python.
- 22:15And so in order to run Python in Docker, you just say Docker run Python.
- 22:22Eventually, you could qualify that to say if you want Python 2 or Python 3.
- 22:27Or there are labels on these images that let you specify a more fine-grained version of Python.
- 22:34And once you run the image, it comes with a...
- 22:40I don't remember which flavor of Linux.
- 22:42And then Python all installed with the tools for developing there or for running Python workloads.
- 22:49That sounds like a really easy way to get started for the Python developers.
- 22:52That's cool.
- 22:53Yeah, and that's one of the things that I love.
- 22:56So I joined Docker just two months ago.
- 23:01Before that, I was at Microsoft where my role as part of the developer experience team
- 23:08was to bring all the Docker partner ecosystem on Azure.
- 23:12And so as part of doing that, I built a bunch of tools to deploy clusters on Azure.
- 23:19And the tool I built for that was in Python.
- 23:22And I interacted with lots of startups using Python.
- 23:25And when I started talking about my tools to other Microsoft people and I started giving trainings about that,
- 23:32these guys were on Windows.
- 23:34They didn't have Python installed.
- 23:36They said, how do I run that script?
- 23:38And in order to make that easier, I just bundled all my script in a Docker image.
- 23:45And I just told them, hey, you just run that image and you'll have Python 2 installed,
- 23:51all the requirements for the tool that I built, like the Azure Python SDK, all pre-installed.
- 23:57And you don't need to install anything.
- 23:59It's just a Docker run away from running.
- 24:03That's really cool.
- 24:05It sounds like an interesting world to live in, working with a lot of the Windows stuff.
- 24:09And actually, one of the things I'd kind of like to talk about in a minute is the Docker view from different operating systems.
- 24:16I mean, if I'm on Linux, it makes perfect sense.
- 24:18It's kind of like a Linux thing.
- 24:19I can run Docker right on Ubuntu, things like that.
- 24:22Yeah.
- 24:23But if I'm on, say, let's say, on my Mac, what do I do there?
- 24:27Yeah, so on a Mac, you can download an installer from docker.com.
- 24:31So we always release all our versions on Linux, Mac, and Windows.
- 24:38And so you download that installer and what it's doing because the engine relies on primitives in the Linux kernel.
- 24:47It needs to run on Linux.
- 24:48And so we have this tool that's downloaded as part of the installer that's called Boot2Docker
- 24:53that starts behind the scene a VirtualBox VM running Linux where the engine is installed.
- 25:01And then you run the client on your Mac, and your client is targeting that VirtualBox instance.
- 25:07And then by changing the environment variables, you can just target, instead of targeting your local machine,
- 25:15your local VirtualBox instance on your Mac, you can target a box in Azure or Google Compute Engine or Amazon.
- 25:24So that's pretty easy.
- 25:26Yeah, in terms of operating system, one of the things that I'm super happy about that happened,
- 25:31that was launched a few weeks ago and that was announced at the build,
- 25:37conference last week from Microsoft, that Microsoft really bet heavily on Docker.
- 25:44And what they've done is that they have contributed a lot of code to Docker so that now the Docker client runs on Windows.
- 25:52So you can run the Docker client and then target Linux machines.
- 25:56You can use Boot2Docker on Windows as well.
- 25:59So you can run your Linux workloads on Windows with that and develop.
- 26:02That's cool.
- 26:04So that kind of puts it on par with OS X maybe.
- 26:06Yeah, exactly.
- 26:07Puts it on par with OS X.
- 26:09But they're going to run the Docker client.
- 26:20So that's cool.
- 26:30So that's really a big news.
- 26:32So Microsoft likes the Docker workflow for devs and ops so much that they wanted to give that to Windows developers and Windows sysadmins.
- 26:43So they modified Windows server to have the same isolation primitive that exists in Linux.
- 26:50And then they implemented the Docker daemon in terms of that.
- 26:53So that's not out yet.
- 26:56They just gave a demo last week.
- 26:58But it's going to shift with the next version of Windows server.
- 27:02And there will be a preview this summer.
- 27:05So that means that you'll be able to develop .NET applications running on Windows server inside of Docker containers.
- 27:13Which means that for developers and sysadmins in enterprise who are typically working half and half with Java and .NET,
- 27:21they'll be able to just deploy or to build their microservices in the technology that fits the best.
- 27:30Yeah, that's really cool.
- 27:32I'm glad you brought that up.
- 27:33I was watching the Build conference last week as well.
- 27:35And just for the listeners, because of time shifting, we're recording on Monday, May 4th.
- 27:40And Build, I think this was announced last Wednesday, so four or five days ago.
- 27:43And one of the very first things they announced at the entire conference was your CEO, Ben Golub, coming out and saying, you know, from Docker, saying,
- 27:55look, we're working with Microsoft doing amazing things.
- 27:57And we started out maybe trying to bring it on par with OS X.
- 28:01But the Microsoft guys wanted to go even farther and actually add features to Windows, the OS,
- 28:07that would allow it to have containers for its operating system and its processes.
- 28:11Because until this moment, there was no possibility of something like Docker on Windows for Windows apps.
- 28:18Yeah, yeah, it's pretty incredible.
- 28:20So, I mean, to me, that means like now we have the two major operating systems that run software and the servers in the data centers,
- 28:28both supporting containers, both working with Docker.
- 28:31And that's a huge boost for you guys, right?
- 28:32Yeah, yeah, it is.
- 28:33It is definitely.
- 28:34And I think it's very good for the Windows ecosystem as well, because it will bring them the same kind of tools that Linux developers and admins have been enjoying for a long time.
- 28:45And it really allows for more dense workloads on your servers and in the data center.
- 28:51Yeah, that's really cool.
- 28:52So the DevOps story just gets way better over there, I think.
- 28:54Yeah, exactly.
- 28:55So I'd like to talk a little bit about Python with you.
- 28:58But before we do, what do you think the future holds for Docker and containers?
- 29:01Where are things going in this whole world?
- 29:04Yeah, so we have DockerCon, which is our big conference that's happening in June.
- 29:09And one of the things we've been working on, as I explained to you before, Docker takes care of a lot of aspects, but it still needs to mature in lots of areas.
- 29:20And especially when people start putting it in production, there are lots of needs that are still unfulfilled by the tool.
- 29:27So one of the big aspects that we've been working on recently is to make it pluggable.
- 29:33So we're working on a plugin model with people like Weave, who are building virtual networking, or ClusterHQ, who are building portable volumes,
- 29:43so that they can run as plugin in Docker Engine, and so that you would be able to define networks for your containers that span your own data center,
- 29:57and maybe Azure and Google, or like two public clouds.
- 30:02So that's on the Weave side, and on the ClusterHQ side, it's like moving volumes from one to the other.
- 30:08We're also working on making sure Docker Machine lets you provision Docker daemons everywhere.
- 30:14There's been lots of improvement to Docker Compose.
- 30:18And also, one of the big topics that's happening right now is once you start building all your apps as microservices running in containers,
- 30:26the next step is how do you orchestrate them?
- 30:29And I have a whole deck on that that I'd send you where there's at least six or seven containers in that space.
- 30:39Again, as I used to say, the whole industry reorganized around this.
- 30:44Before, people were building platforms as a service, and that whole industry refocused towards orchestrating Docker containers.
- 30:53So the unit now is the microservice package as a container.
- 30:58And in the orchestrators, you have Docker Swarm, which is one from Docker itself.
- 31:04So it's a native orchestration solution that works multi-cloud.
- 31:07There's Kubernetes from Google that's inspired by what's running internally at Google, and that's open source.
- 31:15There's Apache Mesos, done by Mesosphere.
- 31:18And they're running in production in lots of different places.
- 31:22They're coming from Twitter originally.
- 31:24I think Netflix runs it as well.
- 31:26And there are smaller players like DS or Tutum, which is running on Azure as well.
- 31:34So there's lots of activity in that space of our Docker container orchestration.
- 31:38Yeah, that seems like where the real challenges lie.
- 31:41And if that gets easier and easier, then, you know, the sky's the limit.
- 31:45So that's amazing.
- 31:46Yeah, on the Docker side, we're trying to make the whole experience easier, like with machines,
- 31:52like one command to provision new machines in different clouds.
- 31:55And then it's integrated with Swarm.
- 31:58So you can say, oh, I want all these machines to be in a single cluster.
- 32:01And then with Docker Compose, you can say, oh, I want to, or there's the start of an integration
- 32:08where you can say, my app that's composed of multiple services, please deploy that to that Swarm instance.
- 32:14And then it will just provision it in the right place in the cluster where there's some room.
- 32:19So we're really trying to make the experience much easier for developers and sysadmins.
- 32:24Cool.
- 32:25Yeah.
- 32:25The more you guys encourage and make it easy to break our apps into small little services,
- 32:30then the challenge becomes linking them together, right?
- 32:33So it sounds like you're doing some great work there.
- 32:35Fantastic.
- 32:35Yeah.
- 32:36And one advantage I will have to add that there is to this microservice approach and that Docker enables
- 32:42is once you start breaking your app in microservices, you can start innovating in terms of what language
- 32:51and platform you're using for each of the microservice.
- 32:54So as opposed to being stuck, for example, with a Django app running in Python 2.7 and you made that choice
- 33:02and there's some legacy code that cannot be ported to Python 3, you could say, oh, I just break my app in 10 different microservices
- 33:10and for this microservice, I don't have any legacy.
- 33:12I'm going to write it in Python 3.
- 33:14And for the developers, it's just a matter of saying, oh, I'm inheriting from Python 3 as opposed to Python 2 when you're creating your image.
- 33:25Oh, that's really neat.
- 33:26So maybe it's a gateway for a little more flexibility in the technology to...
- 33:31Yeah.
- 33:31And I think especially for the Python community where that big gap between Python 2 and Python 3 developers happen,
- 33:40I think this breaking up of large monolithic applications into smaller microservices where you have more freedom to test new stuff
- 33:49may be a good way of introducing Python 3 to your environment.
- 33:53For sure.
- 33:53Do you see anything like that happening in the data side of things?
- 33:57So, you know, if I'm using MySQL and relational databases in some big monolithic way,
- 34:02like, could my different microservices be using, like, NoSQL, say, MongoDB or Redis here and there,
- 34:09and then maybe one other part still using a relational database?
- 34:12Oh, yeah.
- 34:12I've seen a lot of that where people are starting...
- 34:15Once your microservices...
- 34:17Your microservice has a smaller footprint and, like, a single functional goal,
- 34:23then it's easier to say, oh, I'm going to back that up with Redis or MongoDB
- 34:28as opposed to storing everything in MySQL
- 34:31because maybe I'm building an e-commerce application and I need the relational aspect for parts of it,
- 34:40but maybe for, like, tracking referrals or the social media aspect of how people are tweeting about products on my website,
- 34:51maybe these small services can use different types of databases or data backends.
- 34:57Yeah, that seems like a perfect way to choose the right database, the right job there.
- 35:01Cool.
- 35:03So you guys, do you use Python internally?
- 35:06You know, obviously you can run Python in Docker containers really well,
- 35:09but do you guys use it as a language for yourself?
- 35:11Actually, we do.
- 35:12Not everybody.
- 35:14So Docker itself is written in Go as well as Docker Machine and Swarm.
- 35:20But Docker Compose is actually written in Python, so it's a Python project.
- 35:26Nice.
- 35:26And how's that?
- 35:26People are pretty happy with Python internally?
- 35:28Yeah, and I think they even tried to call it to Go at some point,
- 35:33but then they said, hey, we have high velocity with Python,
- 35:37we have a code base that people understand well, so let's stick with that.
- 35:42So I think Compose for now will stay in Python,
- 35:45and the developers who are working on it are pretty happy with it.
- 35:49Yeah, that's really cool.
- 35:50So if, you know, I'm a listener and I'm out there hearing this,
- 35:54and I'm like, this is awesome, I have to get started.
- 35:56What do I do?
- 35:56How do I get started?
- 35:57Yeah, to get started, you go to docker.com.
- 36:00We have lots of tutorials.
- 36:02If you're on a Mac, you just download Docker for Mac, for Linux.
- 36:06Depending on the distro, either there are packages
- 36:08or you can download the binaries directly.
- 36:11And for Windows, there's an installer as well.
- 36:13There's also another project you may want to take a look at,
- 36:17that's called Ketmatic.
- 36:18That one runs only on macOS, and it's a Docker client GUI.
- 36:25So it shows you all the containers that you can find on Docker Hub,
- 36:30and you can say, oh, just start this one,
- 36:32launch a terminal where I can script it or connect to it,
- 36:36and it shows you the logs, the volume that you have attached,
- 36:41so you can go edit the files and all that.
- 36:43So that's a very easy way to get started, Ketmatic, I would say.
- 36:48And else?
- 36:49Yeah, I have Ketmatic installed, and I enjoy it.
- 36:51It's nice.
- 36:52It's clean and works well.
- 36:53Yeah, there's lots of stuff to add in there,
- 36:55but it's really a good start, and it's very easy to get started.
- 36:59Excellent.
- 37:00So I think it's probably a place to call it a show, Patrick.
- 37:05What else would you like to add while we've got a chance to talk to everyone?
- 37:08I mean, thanks very much for the opportunity.
- 37:10I really encourage Python developers to go take a look at that.
- 37:16To me, one of the angles that's most interesting for Python developers
- 37:20is giving you the portability for your customers to run your code anywhere
- 37:26without having a complicated environment to set up.
- 37:30As long as they have Docker, they can just start your app packaged as a container.
- 37:36And the other angle that's, I think, pretty important
- 37:39is starting to introduce Python 3 microservices into your app.
- 37:44If all your apps are packaged as containers, it just doesn't matter.
- 37:49You don't need to set up complicated environments.
- 37:52It's just a change of the label in the from directive in your Docker file
- 38:00to start using Python 3.
- 38:02I am very excited about Docker and this whole container world.
- 38:07And I appreciate you taking the time to share it with everyone.
- 38:09Thanks, Michael.
- 38:10You're welcome, Patrick.
- 38:11Bye.
- 38:12Bye.
- 38:13This has been another episode of Talk Python To Me.
- 38:16Today's guest was Patrick Shanazin, and this episode has been sponsored by Codeship.
- 38:22Please check them out at Codeship.com and thank them on Twitter via at Codeship.
- 38:26Don't forget the discount code for listeners.
- 38:28It's easy.
- 38:29Talk Python, all caps, no spaces.
- 38:31Remember, you can find the links from this show at talkpythontome.com
- 38:37slash episodes slash show slash nine.
- 38:40And if you're feeling generous, please check out our Patreon campaign
- 38:43at patreon.com slash mkennedy to contribute and support the show.
- 38:48And be sure to subscribe to the show.
- 38:49Visit the website and choose subscribe in iTunes
- 38:52or grab the episode RSS feed and drop it into your favorite podcatcher.
- 38:56You'll find both at the footer of every page.
- 38:58This is your host, Michael Kennedy.
- 39:00Thanks for listening.
- 39:13Bye.
- 39:14Bye.
- 39:14Bye.
- 39:14Bye.
- 39:14first, develop first, develop first, develop first, develop first.
- 39:20Developers, developers, developers, developers.
- 39:22you
- 39:23Thank you.