使用WildFly和Java EE 7映像与Docker提供者一起流浪
什么是無業(yè)游民?
Vagrant是創(chuàng)建虛擬開發(fā)環(huán)境的簡化且可移植的方式。 它可與多種虛擬化軟件一起使用,例如VirtualBox,VMWare,AWS等。 它還可以與多種配置軟件一起使用,例如Ansible,Chef,Puppet或Salt。
不再需要“在我的機器上工作”!
通常,提供者是通常的。 從1.6版開始,Docker容器也可以用作后端提供程序之一。 這使您的開發(fā)環(huán)境可以基于Docker容器而不是完整的虛擬機。 在docs.vagrantup.com/v2/docker/index.html上了解有關此內容的更多信息。
完整的開發(fā)環(huán)境定義(例如機器類型,需要安裝的軟件,網絡和其他配置信息)在文本文件(通常稱為Vagrantfile 。 基于提供者,它創(chuàng)建了虛擬開發(fā)環(huán)境。
在docs.vagrantup.com/v2/vagrantfile/index.html上了解有關文件中定義內容以及方法的更多信息。
流浪漢入門
入門指南非常簡單,易于遵循,讓Vagrant弄濕你的腳。 創(chuàng)建基本定義后,即可使用簡單的命令啟動環(huán)境:
vagrant up完整的命令集在docs.vagrantup.com/v2/cli/index.html上定義。
Vagrant的默認提供程序是VirtualBox。 可以在CLI上將備用提供程序指定為:
vagrant up --provider=docker這將根據Vagrantfile中指定的映像啟動Docker容器。
包裝形式
無業(yè)游民的環(huán)境被打包為Boxs 。 您可以從公開可用的框列表中進行搜索,以找到所需的框。 甚至創(chuàng)建自己的盒子,并使用以下命令將它們添加到中央存儲庫:
vagrant box add USER/BOX流浪于WildFly Docker映像
學習完基本命令后,讓我們看看使用Vagrant啟動WildFly Docker映像需要做什么。
所述Vagrantfile在定義github.com/arun-gupta/vagrant-images/blob/master/docker-wildfly/Vagrantfile和在線所示:
Vagrant.configure(2) do |config|config.vm.provider "docker" do |d|# Define the Docker imaged.image = "jboss/wildfly:latest"end end克隆git repo并更改為docker-wildfly目錄。 可以使用以下命令啟動流浪圖像:
vagrant up --provider=docker并將輸出顯示為:
docker-wildfly> vagrant up Bringing machine 'default' up with 'docker' provider... ==> default: Docker host is required. One will be created if necessary...default: Vagrant will now create or start a local VM to act as the Dockerdefault: host. You'll see the output of the `vagrant up` for this VM below.default: default: Box 'mitchellh/boot2docker' could not be found. Attempting to find and install...default: Box Provider: virtualboxdefault: Box Version: >= 0default: Loading metadata for box 'mitchellh/boot2docker'default: URL: https://atlas.hashicorp.com/mitchellh/boot2dockerdefault: Adding box 'mitchellh/boot2docker' (v1.2.0) for provider: virtualboxdefault: Downloading: https://atlas.hashicorp.com/mitchellh/boxes/boot2docker/versions/1.2.0/providers/virtualbox.boxdefault: Successfully added box 'mitchellh/boot2docker' (v1.2.0) for 'virtualbox'!default: Importing base box 'mitchellh/boot2docker'...default: Matching MAC address for NAT networking...default: Checking if box 'mitchellh/boot2docker' is up to date...default: Setting the name of the VM: docker-host_default_1421277252359_12510default: Fixed port collision for 22 => 2222. Now on port 2203.default: Clearing any previously set network interfaces...default: Preparing network interfaces based on configuration...default: Adapter 1: natdefault: Forwarding ports...default: 2375 => 2375 (adapter 1)default: 22 => 2203 (adapter 1)default: Running 'pre-boot' VM customizations...default: Booting VM...default: Waiting for machine to boot. This may take a few minutes...default: SSH address: 127.0.0.1:2203default: SSH username: dockerdefault: SSH auth method: private keydefault: Warning: Connection timeout. Retrying...default:default: Vagrant insecure key detected. Vagrant will automatically replacedefault: this with a newly generated keypair for better security.default:default: Inserting generated public key within guest...default: Removing insecure key from the guest if its present...default: Key inserted! Disconnecting and reconnecting using new SSH key...default: Machine booted and ready! ==> default: Syncing folders to the host VM...default: Installing rsync to the VM...default: Rsyncing folder: /Users/arungupta/workspaces/vagrant-images/docker-wildfly/ => /var/lib/docker/docker_1421277277_78698 ==> default: Warning: When using a remote Docker host, forwarded ports will NOT be ==> default: immediately available on your machine. They will still be forwarded on ==> default: the remote machine, however, so if you have a way to access the remote ==> default: machine, then you should be able to access those ports there. This is ==> default: not an error, it is only an informational message. ==> default: Creating the container...在固定#5187之前,該功能將不起作用。 但是至少該博客解釋了Vagrant的主要概念。
翻譯自: https://www.javacodegeeks.com/2015/01/vagrant-with-docker-provider-using-wildfly-and-java-ee-7-image.html
總結
以上是生活随笔為你收集整理的使用WildFly和Java EE 7映像与Docker提供者一起流浪的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 水晶路由器设置(水星路由器设置app)
- 下一篇: 台式电脑显卡怎么装在电脑上电脑如何装显卡