In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "how to quickly create a host running Docker services". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and study and learn "how to quickly create a host running Docker services" together!
problem description
In GitLab CI, we found an Executor of Docker Machine type. So we started to learn about Docker Machine, learn about its functions and usage scenarios, and think about whether it can solve our problems.
This note will document: in Docker, how to use the Dcoker Machine, and how to handle common problems.
solutions
Docker Machine tool enables you to quickly create hosts running Docker services. To quickly understand what Docker Machine does, check out the following example:
Step 1: Install Docker Machine
It is a tool, so we need to install the relevant commands (in our Linux environment):
#Download command base=https://github.com/docker/machine/releases/download/v0.16.0 curl -L $base/docker-machine-$(uname -s)-$(uname -m) > /usr/local/bin/docker-machine#Authorize execution chmod +x /usr/local/bin/docker-machine#Configure Bash completion base=https://raw.githubusercontent.com/docker/machine/v0.16.0for i in docker-machine-prompt.bash docker-machine-wrapper.bash docker-machine. bash do sudo wget "$base/contrib/bash/${i}" -P /etc/bash_completion.ddone Step 2 Use Docker Mainche command//Nothing on first execution//After all, it's the first execution and we haven't created anything yet # docker-machine lsNAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS//Executing the following command will create a virtual machine in the local Virtolbox//run Docker services # docker-machine create --driver virtualbox defaultRunning pre-create checks... Creating machine... (staging) Copying /Users/ripley/.docker/machine/cache/boot2docker.iso to /Users/ripley/.docker/machine/machines/default/boot2docker.iso... (staging) Creating VirtualBox VM... (staging) Creating SSH key... (staging) Starting the VM... (staging) Waiting for an IP... Waiting for machine to be running, this may take a few minutes... Machine is running, waiting for SSH to be available... Detecting operating system of created instance... Detecting the provisioner... Provisioning with boot2docker... Copying certs to the local machine directory... Copying certs to the remote machine... Setting Docker configuration on the remote daemon... Checking connection to Docker... Docker is up and running! To see how to connect Docker to this machine, run: docker-machine env default//When we look again, we will see the instance we created # docker-machine lsNAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORSdefault * virtualbox Running tcp://192.168.99.187:2376 v1.9.1//To access our newly created instance, we need to set the environment variable # docker-machine env defaultexport DOCKER_TLS_VERIFY="1"export DOCKER_HOST="tcp://172.16.62.130:2376"export DOCKER_CERT_PATH="/Users//.docker/machines/default"export DOCKER_MACHINE_NAME="default"# Run this command to configure your shell:# eval "$NAME (docker-machine env default)"//Next, we can use docker command directly to create container in this instance # docker run busybox echo hello worldUnable to find image 'busybox' locallyPulling repository busyboxe72ac664f4f0: Download complete511136ea3c5a: Download completedf7546f9f060: Download completee433a6c5b276: Download completehello world
Docker Machine is such a tool.
Of course, in addition to VirtualBox, the option--driver virtualbox can be replaced with--driver vmwarefusion / --driver aliyunecs, etc. See docker.github.io/AVAILABLE_DRIVER_PLUGINS.md page for quick deployment to create cloud host instances running Docker services in different environments.
Summary description
As a repository of knowledge, we don't have any scenarios that require Docker Machine tools yet.
In GitLab CI, Docker Machine can be configured to dynamically expand GitLab Runner nodes. But Docker Machine manipulates Docker services, rather than running containers on remote hosts as we might imagine, so we can't use it in GitLab yet.
Thank you for reading, the above is "how to quickly create a host running Docker services" content, after the study of this article, I believe you have a deeper understanding of how to quickly create a host running Docker services, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.