天天看点

docker安装_使用WildFly和Java EE 7映像与Docker提供者一起流浪

docker安装_使用WildFly和Java EE 7映像与Docker提供者一起流浪

docker安装

什么是流浪汉?

docker安装_使用WildFly和Java EE 7映像与Docker提供者一起流浪
docker安装_使用WildFly和Java EE 7映像与Docker提供者一起流浪

Vagrant是创建虚拟开发环境的简化且可移植的方式。 它可与多种虚拟化软件一起使用,例如VirtualBox,VMWare,AWS等。 它还可以与多种配置软件一起使用,例如Ansible,Chef,Puppet或Salt。

不再需要“在我的机器上工作”!通常,提供者是通常的。 从1.6版开始,Docker容器也可以用作后端提供程序之一。 这使您的开发环境可以基于Docker容器而不是完整的虚拟机。 在docs.vagrantup.com/v2/docker/index.html上了解有关此内容的更多信息。

在文本文件(通常称为

Vagrantfile

)中定义了完整的开发环境定义,例如机器的类型,需要安装的软件,网络和其他配置信息。 基于提供者,它创建了虚拟开发环境。

在docs.vagrantup.com/v2/vagrantfile/index.html上了解有关文件中定义内容以及方法的更多信息。

Vagrant入门

入门指南非常简单,易于遵循,让Vagrant弄湿你的脚。 创建基本定义后,可以使用简单的命令启动环境:

vagrant up
           

完整的命令集在docs.vagrantup.com/v2/cli/index.html上定义。

Vagrant的默认提供程序是VirtualBox。 可以在CLI上将备用提供程序指定为:

vagrant up --provider=docker
           

这将根据Vagrantfile中指定的映像启动Docker容器。

包装形式

无业游民的环境被打包为Boxs 。 您可以从公开可用的框列表中搜索,以找到所需的框。 甚至创建自己的盒子,并使用以下命令将它们添加到中央存储库:

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 image
     d.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 Docker
    default: 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: virtualbox
    default: Box Version: >= 0
    default: Loading metadata for box 'mitchellh/boot2docker'
    default: URL: https://atlas.hashicorp.com/mitchellh/boot2docker
    default: Adding box 'mitchellh/boot2docker' (v1.2.0) for provider: virtualbox
    default: Downloading: https://atlas.hashicorp.com/mitchellh/boxes/boot2docker/versions/1.2.0/providers/virtualbox.box
    default: 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_12510
    default: 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: nat
    default: 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:2203
    default: SSH username: docker
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: 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

docker安装