Nicht aus der Schweiz? Besuchen Sie lehmanns.de

Docker Deep Dive. (eBook)

Zero to Docker in a Single Book

(Autor)

eBook Download: EPUB
2023
266 Seiten
Packt Publishing (Verlag)
978-1-83508-791-6 (ISBN)

Lese- und Medienproben

Docker Deep Dive. - Nigel Poulton
Systemvoraussetzungen
25,19 inkl. MwSt
(CHF 24,60)
Der eBook-Verkauf erfolgt durch die Lehmanns Media GmbH (Berlin) zum Preis in Euro inkl. MwSt.
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

Most applications, even the funky cloud-native microservices ones, need high-performance, production-grade infrastructure to run on. Having impeccable knowledge of Docker will help you thrive in the modern cloud-first world. With this book, you will gain the skills you need in order to work with Docker and its containers.
The book begins with an introduction to containers and explains their functionality and application in the real world. You will then get an overview of VMware, Kubernetes, and Docker and learn to install Docker on Windows, Mac, and Linux. Once you have understood the Ops and Dev perspective of Docker, you will be able to see the big picture and understand what Docker exactly does. The book then turns its attention to the more technical aspects, guiding you through practical exercises covering Docker engine, Docker images, and Docker containers. You will learn techniques for containerizing an app, deploying apps with Docker Compose, and managing cloud-native applications with Swarm. You will also build Docker networks and Docker overlay networks and handle applications that write persistent data. Finally, you will deploy apps with Docker stacks and secure your Docker environment.
By the end of this book, you will be well-versed in Docker and containers and have developed the skills to create, deploy, and run applications on the cloud.


Start from scratch and develop the essential skills needed to create, deploy, and manage cloud-native applications using Docker with the latest edition of Docker Deep DiveKey FeaturesGet a solid understanding of Docker and containersOvercome common problems while containerizing an applicationMaster Docker commands needed for creating, deploying, and running applicationsBook DescriptionMost applications, even the funky cloud-native microservices ones, need high-performance, production-grade infrastructure to run on. Having impeccable knowledge of Docker will help you thrive in the modern cloud-first world. With this book, you will gain the skills you need in order to work with Docker and its containers. The book begins with an introduction to containers and explains their functionality and application in the real world. You will then get an overview of VMware, Kubernetes, and Docker and learn to install Docker on Windows, Mac, and Linux. Once you have understood the Ops and Dev perspective of Docker, you will be able to see the big picture and understand what Docker exactly does. The book then turns its attention to the more technical aspects, guiding you through practical exercises covering Docker engine, Docker images, and Docker containers. You will learn techniques for containerizing an app, deploying apps with Docker Compose, and managing cloud-native applications with Swarm. You will also build Docker networks and Docker overlay networks and handle applications that write persistent data. Finally, you will deploy apps with Docker stacks and secure your Docker environment. By the end of this book, you will be well-versed in Docker and containers and have developed the skills to create, deploy, and run applications on the cloud.What you will learnBecome familiar with the applications of Docker and containersDiscover how to pull images into Docker host's local registryFind out how to containerize an app with new example appsCover multi-platform builds to test Docker overlay network in the swarm modeUse Docker Compose to deploy and manage multi-container applicationsShare sensitive data with containers and Swarm services securelyWho this book is forWhether you are a beginner or an experienced developer looking to utilize Docker to develop and operate cloud-native microservices apps, this book is for you. Anyone who wants to learn Docker orchestration, networking, imaging, and security will also find it useful. No prior knowledge of Docker is necessary.]]>

3: Installing Docker


There are lots of ways and places to install Docker. There’s Windows, Mac, and Linux. You can install in the cloud, on premises, and on your laptop. And there are manual installs, scripted installs, wizard-based installs…

But don’t let that scare you. They’re all really easy, and a simple search for “how to install docker on <insert your choice here>” will reveal up-to-date instructions that are easy to follow. As a result, we won’t waste too much space here. We’ll cover the following.

  • Docker Desktop
    • Windows
    • MacOS
  • Multipass
  • Server installs on
    • Linux
  • Play with Docker

Docker Desktop


Docker Desktop is a desktop app from Docker, Inc. that makes it super-easy to work with containers. It includes the Docker engine, a slick UI, and an extension system with a marketplace. These extensions add some very useful features to Docker Desktop such as scanning images for vulnerabilities and making it easy to manage images and disk space.

Docker Desktop is free for educational purposes, but you’ll have to pay if you start using it for work and your company has over 250 employees or does more than $10M in annual revenue.

It runs on 64-bit versions of Windows 10, Windows 11, MacOS, and Linux.

Once installed, you have a fully working Docker environment that’s great for development, testing, and learning. It includes Docker Compose and you can even enable a single-node Kubernetes cluster if you need to learn Kubernetes.

Docker Desktop on Windows can run native Windows containers as well as Linux containers. Docker Desktop on Mac and Linux can only run Linux containers.

We’ll walk through the process of installing on Windows and MacOS.

Windows pre-reqs

Docker Desktop on Windows requires all of the following:

  • 64-bit version of Windows 10/11
  • Hardware virtualization support must be enabled in your system’s BIOS
  • WSL 2

Be very careful changing anything in your system’s BIOS.

Installing Docker Desktop on Windows 10 and 11

Search the internet or ask your AI assistant how to “install Docker Desktop on Windows”. This will take you to the relevant download page where you can download the installer and follow the instructions. You may need to install and enable the WSL 2 backend (Windows Subsystem for Linux).

Once the installation is complete you may have to manually start Docker Desktop from the Windows Start menu. It may take a minute to start but you can watch the start progress via the animated whale icon on the Windows task bar at the bottom of the screen.

Once it’s up and running you can open a terminal and type some simple docker commands.

$ docker version Client: Cloud integration: v1.0.31 Version: 20.10.23 API version: 1.41 Go version: go1.18.10 Git commit: 7155243 Built: Thu Jan 19 01:20:44 2023 OS/Arch: linux/amd64 Context: default Experimental: true Server: Engine: Version: 20.10.23 <Snip> OS/Arch: linux/amd64 Experimental: true

Notice the output is showing OS/Arch: linux/amd64 for the Server component. This is because a default installation assumes you’ll be working with Linux containers.

You can easily switch to Windows containers by right-clicking the Docker whale icon in the Windows notifications tray and selecting Switch to Windows containers....

Be aware that any existing Linux containers will keep running in the background but you won’t be able to see or manage them until you switch back to Linux containers mode.

Run another docker version command and look for the windows/amd64 line in the Server section of the output.

C:/> docker version Client: <Snip> Server: Engine: <Snip> OS/Arch: windows/amd64 Experimental: true

You can now run and manage Windows containers (containers running Windows applications).

Congratulations. You now have a working installation of Docker on your Windows machine.

Installing Docker Desktop on Mac

Docker Desktop for Mac is like Docker Desktop on Windows — a packaged product with a slick UI that gets you a single-engine installation of Docker that’s ideal for local development needs. You can also enable a single-node Kubernetes cluster.

Before proceeding with the installation, it’s worth noting that Docker Desktop on Mac installs all of the Docker engine components in a lightweight Linux VM that seamlessly exposes the API to your local Mac environment. This means you can open a terminal on your Mac and use the regular Docker commands without ever knowing it’s all running in a hidden VM. This is why Docker Desktop on Mac only work with Linux containers – it’s all running inside a Linux VM. This is fine as Linux is where most of the container action is.

Figure 3.1 shows the high-level architecture for Docker Desktop on Mac.

Figure 3.1

The simplest way to install Docker Desktop on your Mac is to search the web or ask your AI how to “install Docker Desktop on MacOS”. Follow the links to the download and then complete the simple installer.

Once the installation is complete you may have to manually start Docker Desktop from the MacOS Launchpad. It may take a minute to start but you can watch the animated Docker whale icon in the status bar at the top of your screen. Once it’s started you can click the whale icon to manage Docker Desktop.

Open a terminal window and run some regular Docker commands. Try the following.

$ docker version Client: Cloud integration: v1.0.31 Version: 23.0.5 API version: 1.42 <Snip> OS/Arch: darwin/arm64 Context: desktop-linux Server: Docker Desktop 4.19.0 (106363) Engine: Version: dev API version: 1.43 (minimum version 1.12) <Snip> OS/Arch: linux/arm64 Experimental: false containerd: Version: 1.6.20 GitCommit: 2806fc1057397dbaeefbea0e4e17bddfbd388f38 runc: Version: 1.1.5 GitCommit: v1.1.5-0-gf19387a <Snip>

Notice that the OS/Arch: for the Server component is showing as linux/amd64 or linux/arm64. This is because the daemon is running inside the Linux VM mentioned earlier. The Client component is a native Mac application and runs directly on the Mac OS Darwin kernel which is why it shows as either darwin/amd64 or darwin/arm64.

You can now use Docker on your Mac.

Installing Docker with Multipass


Multipass is a free tool for creating cloud-style Linux VMs on your Linux, Mac, or Windows machine. It’s my go-to choice for Docker testing on my laptop as it’s incredibly easy to spin-up and tear-down Docker VMs.

Just go to https://multipass.run/install and install the right edition for your hardware and OS.

Once installed you’ll only need the following three commands:

$ multipass launch $ multipass ls $ multipass shell

Let’s see how to launch and connect to a new VM that will have Docker pre-installed.

Run the following command to create a new VM called node1 based on the docker image. The docker image has Docker pre-installed and ready to go.

$ multipass launch docker --name node1

It’ll take a minute or two to download the image and launch the VM.

List VMs to make sure it launched properly.

$ multipass ls Name State IPv4 Image node1 Running 192.168.64.37 Ubuntu 22.04 LTS 172.17.0.1 172.18.0.1

You’ll use the 192 IP address when working with the examples later in the book.

Connect to the VM with the following command.

$ multipass shell node1

You’re now logged on to the VM and can run regular Docker commands.

Just type exit to log out of the VM. Use multipass delete node1 and then multipass purge to delete it.

Installing Docker on Linux


There are lots of ways to install Docker on Linux and most of them are easy. The recommended way is to search the web or ask your AI how to do it. The instructions in this section may be out of date and just for guidance purposes.

In this section we’ll look at one of the ways to install Docker on Ubuntu Linux 22.04 LTS. The procedure assumes you’ve already installed Linux and are logged on.

  1. Remove existing Docker packages.
    $ sudo apt-get remove docker docker-engine docker.io containerd runc
  2. Update the apt package index.
    $ sudo apt-get update $ sudo apt-get install ca-certificates curl gnupg ...
  3. Add the Docker GPG kye.
    $ sudo install -m 0755 -d /etc/apt/keyrings $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | / sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg $ sudo chmod a+r /etc/apt/keyrings/docker.gpg
  4. Set-up the repository. ...

Erscheint lt. Verlag 20.7.2023
Sprache englisch
Themenwelt Mathematik / Informatik Informatik Netzwerke
Mathematik / Informatik Informatik Theorie / Studium
ISBN-10 1-83508-791-4 / 1835087914
ISBN-13 978-1-83508-791-6 / 9781835087916
Haben Sie eine Frage zum Produkt?
EPUBEPUB (Ohne DRM)

Digital Rights Management: ohne DRM
Dieses eBook enthält kein DRM oder Kopier­schutz. Eine Weiter­gabe an Dritte ist jedoch rechtlich nicht zulässig, weil Sie beim Kauf nur die Rechte an der persön­lichen Nutzung erwerben.

Dateiformat: EPUB (Electronic Publication)
EPUB ist ein offener Standard für eBooks und eignet sich besonders zur Darstellung von Belle­tristik und Sach­büchern. Der Fließ­text wird dynamisch an die Display- und Schrift­größe ange­passt. Auch für mobile Lese­geräte ist EPUB daher gut geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür die kostenlose Software Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür eine kostenlose App.
Geräteliste und zusätzliche Hinweise

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Das umfassende Handbuch

von Martin Linten; Axel Schemberg; Kai Surendorf

eBook Download (2023)
Rheinwerk Computing (Verlag)
CHF 20,45
das Praxisbuch für Administratoren und DevOps-Teams

von Michael Kofler

eBook Download (2023)
Rheinwerk Computing (Verlag)
CHF 27,25