search
HomeOperation and MaintenanceDockerWhat is the docker ecosystem?

What is the docker ecosystem?

May 11, 2022 pm 02:49 PM
docker

The ecosystem includes: 1. Docker Hub, which is an official resource for pre-written Dockerfiles and provides public and private image repositories; 2. Docker Engine, the core software used to run and manage containers; 3 , Kitematic, is a visual management tool; 4. Machine and Swarm, provide a simple set of tools for various virtualization and cloud service providers to move and scale their local projects; 5. Compose; 6. Cloud ; 7. Center.

What is the docker ecosystem?

The operating environment of this tutorial: linux5.9.8 system, docker-1.13.1 version, Dell G3 computer.

Docker is a tool for creating "containers" that contain only what you need for an independent application or technology stack. Unlike virtual machines, these containers share the same resources to manage the interaction between the container and the host. This makes Docker containers fast, lightweight, secure, and shareable.

The currently available Docker ecosystem includes: Docker Hub, Docker Engine, Kitematic, Docker Machine, Swarm, Docker Compose, Dokcer Cloud and Data Center. The functions of these tools will be introduced in detail below. , and how these tools can be better combined.

Docker Hub

The core of any project using Docker is a Dockerfile file. This file contains instructions for how Docker creates an image. Let's look at a simple example:

FROM python:2.7
ADD . /code
WORKDIR /code
RUN pip install -r requirements.txt

In this example, the Dockerfile pulls a specific version of the existing image, copies the current local directory into the container's file system, sets it as the working directory, and then uses the pip command Download Python dependencies from a text file.

Docker Hub is an official resource for pre-written Dockerfiles, providing public (free) and private (paid) image repositories. If you're looking for a Dockerfile to meet your needs, start by searching on Docker Hub and use the project documentation, downloads, and image ratings to help guide your decision.

What is the docker ecosystem?

Docker Engine

Docker Engine is used to run and manage containers core software. Often people refer to it simply as Docker or the Docker Platform. The Docker engine consists of many specialized tools working together to create and run containers, such as APIs, execution drivers, runtimes, shims, etc.

Docker Engine creates Dockerfile files and converts them into usable containers. Docker Engine is the core of Docker. Without Docker Engine, nothing can run. There are several ways to download Docker Engine depending on your operating system. You can Discover more details here .

To start a container based on an image in Docker Hub, you should first pull the image and run it. Continuing with the Python example:

docker pull python
docker run -it --rm --name script-name -v "$PWD":/usr/src/appname -w /usr/src/appname python:3 python app.py

This will pull the latest Python image and then open a container to run a Python script and exit the container after running. The run command provides more option settings, you can Read the complete guide here .

When a Docker run command starts to become more complex, it may be a better idea to create your own custom Dockerfile. Start a container based on a local Dockerfile and run the following directory containing the files:

docker build -t my_image .

This command will create an image named my_image. Run the following command to start a container based on this image:

docker run -name my_image_container -i -t my_image

This command will open a container based on the custom my_image image. This container is named my_image_container.

Kitematic (Docker visual management tool)

对于那些宁愿避免命令行的用户来说,  Kitematic  是一个 Docker GUI 工具,它可以更快速、更简单的运行Docker容器,现在已经支持 Mac /Windows/Linux。

搜索你需要的镜像,创建一个容器,你最好去Kitematic。Kitematic提供了基本的配置选项,但对于更高级的设置,你可能需要进入命令行。   

What is the docker ecosystem?

你的容器出现在左手边,在那里它们可以被启动、停止、重启,更有用的是,你可以在那里找到容器日志和直接SSH(exec按键)访问。   

What is the docker ecosystem?

Docker Machine和Swarm

生产中使用Docker的第一步是了解  Machine  和Swarm,它们为各种虚拟化和云服务提供商提供了一套简单的工具集用以移动和缩放他们的本地项目。  

“生产中使用Docker的第一步是了解Machine和Swarm。”  

例如,在Azure上创建一个Docker实例:  

docker-machine create -d azure --azure-subscription-id="XXX" --azure-subscription-cert="/mycert.pem" ecodemo

这个命令使用预装的Docker创建一个Ubuntu 12.04-based虚拟机并命名为ecodemo。每个供应商都需要不同的参数和认证方法,这些默认设置可以被重写。在  这个文档  中可以阅读到更多的细节。   

当与  Swarm  结合后,Machine可以创建Docker实例的集群,这个集群被视为一个单一的、大的Docker实例。每一个Swarm集群都需要一个master实例,这个master实例可以用下面的命令来创建:  

docker-machine create
-d virtualbox
--swarm
--swarm-master
--swarm-discovery token://TOKEN_ID
swarm-master

这样就会在VirtualBox中创建一个Docker实例并且设置这个Docker实例为Swarm集群的一个master节点。TOKEN_ID非常重要,因为它可以帮助集群中的所有节点识别彼此。除了手动创建TOKEN_ID标识以外,Swarm也有  发现系统  来帮助你管理这个过程。 

下面的命令使用相同的TOKEN_ID标识添加Docker实例到Swarm集群:  

docker-machine create
-d virtualbox
--swarm
--swarm-discovery token://TOKEN_ID
swarm-node-n

swarm-node-n对于集群中的每一个节点来说都是一个唯一的名字。   

现在,代替从单个虚拟机中开启容器,你可以在集群中开启容器,master节点将会把这个容器分配给最可用的和最有能力的节点。 

Docker Compose

Compose  使得由多个组件(像容器)组成的应用程序更加简单,你可以开始使用一个命令在一个单一的配置文件中声明所有这些组件。   

下面是一个Compose文件(称为docker-compose.yml)的例子,这个例子创建三个  Crate  数据库实例和一个  Laravel  (用一些额外的配置)PHP框架实例。最重要的是,容器与Links配置选项相连。  

crate1:
image: crate
ports:
- "4200:4200"
- "4300:4300"
crate2:
image: crate
crate3:
image: crate
volumes:
- ./data:/importdata
laravelcomposer:
image: dylanlindgren/docker-laravel-composer
volumes:
- /laravel-application:/var/www
command: --working-dir=/var/www install
links:
- crate1
laravelartisan:
image: dylanlindgren/docker-laravel-artisan
links:
- crate1
volumes_from:
- laravelcomposer
working_dir: /var/www
command: serve --host=0.0.0.0:8080
ports:
- "8000:8000"
- "8080:8080"

所有这些实例和它们的配置现在可以通过运行以下在同一目录中的docker-compose.yml文件的命令来开始:  

docker-compose up

What is the docker ecosystem?

你可以使用相同的子命令作为Docker的命令来影响所有以docker-compose开始的容器。例如,docker-compose stop命令可以停止以docker-compose开始的容器。   

What is the docker ecosystem?

Docker Cloud

容器的自动化管理和编排是Docker的主要功能,但却一直由第三方服务来提供,直到去年Docker获得了  Tutum(它支撑着Docker云)  。虽然没有完整的命令行工具(还没有),Docker云服务允许Docker Compose文件设置应用程序栈,所以它不是来自于生态型的其它部分的一个大的导流。  

“容器的自动化管理是Docker的重要组成,但知道最近一直由第三方来提供。”  

例如:  

crate1:
image: crate
ports:
- "4200:4200"
- "4300:4300"
command: crate -Des.network.publish_host=_ethwe:ipv4_
crate2:
image: crate
command: crate -Des.network.publish_host=_ethwe:ipv4_
crate3:
image: crate
command: crate -Des.network.publish_host=_ethwe:ipv4_

这样就创建了同一个镜像的三个实例,其中一个手动设置主机与Docker之间的端口分配,其他的端口分配是自动的。我将很快重新访问command。   

如果你想在超过一个节点(节点能够运行它可以管理的足够多的容器和一个私有仓库上扩展应用程序,Docker Cloud是有偿服务。这对于实验目的来说足够了。记住,Docker Cloud默认管理托管在第三方托管服务器上的容器,所以你也需要支付费用。使得Docker Cloud代理运行在任何你管理的Linux主机上是可能的,你可以  在这里找到操作指南  。   

What is the docker ecosystem?

上面的截图显示了三个使用预先设定的规则运行在跨越两个数字海洋的实例上的Docker容器,这个预先设定的规则是根据你设置的参数来将容器分配给主机。它会自动确保你指定数量的容器始终在运行。   

在之前的Docker Compose例子中,你可能已经注意到_ethwe:ipv4_。这是Docker Cloud的另外一个重要特征。许多分布式应用和服务依赖“  服务发现  ”来找到同一服务的其他实例并进行通信。当在数据中心和物理机器上传播服务时,这往往需要实例的手动说明或者需要另一种方式来找到彼此。   

Docker Cloud包括支持  Weave  在你的实际网络中创建一个“软”网络;所有的容器和应用都可以发现彼此,无论它们被托管在哪里。在上面的例子中,我们重写了向容器发出的默认命令,以确保它接收它需要使用此功能的信息。  

Data Center

到目前为止,本文涉及的大部分工具都是你安装,主机,和支持的工具。对企业用户来说,他们寻找安全性、性能和支持较高的保证,Docker提供了  数据中心  。   

它使用了覆盖这里的许多相同的工具包,但是增加了一个放置你的镜像的私有仓库,一个私有云,高级支持,和供应商可能吸引企业用户的第三方集成。这些包括LDAP and Active Directory用户管理,容器检测,和日志记录。  

推荐学习:《docker视频教程

The above is the detailed content of What is the docker ecosystem?. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How to start containers by dockerHow to start containers by dockerApr 15, 2025 pm 12:27 PM

Docker container startup steps: Pull the container image: Run "docker pull [mirror name]". Create a container: Use "docker create [options] [mirror name] [commands and parameters]". Start the container: Execute "docker start [Container name or ID]". Check container status: Verify that the container is running with "docker ps".

How to view logs from dockerHow to view logs from dockerApr 15, 2025 pm 12:24 PM

The methods to view Docker logs include: using the docker logs command, for example: docker logs CONTAINER_NAME Use the docker exec command to run /bin/sh and view the log file, for example: docker exec -it CONTAINER_NAME /bin/sh ; cat /var/log/CONTAINER_NAME.log Use the docker-compose logs command of Docker Compose, for example: docker-compose -f docker-com

How to check the name of the docker containerHow to check the name of the docker containerApr 15, 2025 pm 12:21 PM

You can query the Docker container name by following the steps: List all containers (docker ps). Filter the container list (using the grep command). Gets the container name (located in the "NAMES" column).

How to create containers for dockerHow to create containers for dockerApr 15, 2025 pm 12:18 PM

Create a container in Docker: 1. Pull the image: docker pull [mirror name] 2. Create a container: docker run [Options] [mirror name] [Command] 3. Start the container: docker start [Container name]

How to exit the container by dockerHow to exit the container by dockerApr 15, 2025 pm 12:15 PM

Four ways to exit Docker container: Use Ctrl D in the container terminal Enter exit command in the container terminal Use docker stop <container_name> Command Use docker kill <container_name> command in the host terminal (force exit)

How to copy files in docker to outsideHow to copy files in docker to outsideApr 15, 2025 pm 12:12 PM

Methods for copying files to external hosts in Docker: Use the docker cp command: Execute docker cp [Options] <Container Path> <Host Path>. Using data volumes: Create a directory on the host, and use the -v parameter to mount the directory into the container when creating the container to achieve bidirectional file synchronization.

How to start mysql by dockerHow to start mysql by dockerApr 15, 2025 pm 12:09 PM

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

How to restart dockerHow to restart dockerApr 15, 2025 pm 12:06 PM

How to restart the Docker container: get the container ID (docker ps); stop the container (docker stop <container_id>); start the container (docker start <container_id>); verify that the restart is successful (docker ps). Other methods: Docker Compose (docker-compose restart) or Docker API (see Docker documentation).

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.