我目前正在尝试创建一个工作的Vagrantfile,它允许我通过Docker启动JIRA实例以进行测试。我的Vagrantfile如下:
Vagrant.configure("2") do |config|
config.vm.provider "docker" do |vb|
vb.has_ssh = true
vb.build_dir = "."
vb.ports = ["8082:8080"]
end
end
Dockerfile:
FROM java:7
# Configuration variables.
ENV JIRA_HOME /var/local/atlassian/jira
ENV JIRA_INSTALL /usr/local/atlassian/jira
ENV JIRA_VERSION 6.4.2
# Install Atlassian Confluence and helper tools and setup initial home
# directory structure.
RUN set -x \
&& apt-get update --quiet \
&& apt-get install --quiet --yes --no-install-recommends libtcnative-1 xmlstarlet \
&& apt-get clean \
&& mkdir -p "${JIRA_HOME}" \
&& chmod -R 700 "${JIRA_HOME}" \
&& chown -R daemon:daemon "${JIRA_HOME}" \
&& mkdir -p "${JIRA_INSTALL}/conf/Catalina" \
&& curl -Ls "http://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-${JIRA_VERSION}.tar.gz" | tar -xz --directory "${JIRA_INSTALL}" --strip-components=1 --no-same-owner \
&& chmod -R 700 "${JIRA_INSTALL}/conf" \
&& chmod -R 700 "${JIRA_INSTALL}/logs" \
&& chmod -R 700 "${JIRA_INSTALL}/temp" \
&& chmod -R 700 "${JIRA_INSTALL}/work" \
&& chown -R daemon:daemon "${JIRA_INSTALL}/conf" \
&& chown -R daemon:daemon "${JIRA_INSTALL}/logs" \
&& chown -R daemon:daemon "${JIRA_INSTALL}/temp" \
&& chown -R daemon:daemon "${JIRA_INSTALL}/work" \
&& echo -e "\njira.home=$JIRA_HOME" >> "${JIRA_INSTALL}/atlassian-jira/WEB-INF/classes/jira-application.properties"
# Use the default unprivileged account. This could be considered bad practice
# on systems where multiple processes end up being executed by 'daemon' but
# here we only ever run one process anyway.
USER daemon:daemon
# Expose default HTTP connector port.
EXPOSE 8080
# Set volume mount points for installation and home directory. Changes to the
# home directory needs to be persisted as well as parts of the installation
# directory due to eg. logs.
VOLUME ["/var/local/atlassian/jira", "/usr/local/atlassian/jira"]
# Set the default working directory as the installation directory.
WORKDIR ${JIRA_INSTALL}
# Run Atlassian JIRA as a foreground process by default.
CMD ["/usr/local/atlassian/jira/bin/start-jira.sh", "-fg"]
Docker镜像成功构建,但是,一旦容器启动并等待机器启动,我就会收到此错误:
/opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/transport/packet_stream.rb:204:in `poll_next_packet': padding error, need 1475902204 block 16 (Net::SSH::Exception)
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/transport/packet_stream.rb:90:in `next_packet'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/transport/session.rb:178:in `block in poll_message'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/transport/session.rb:173:in `loop'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/transport/session.rb:173:in `poll_message'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:460:in `dispatch_incoming_packets'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:269:in `wait'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/communicators/ssh/communicator.rb:576:in `shell_execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/communicators/ssh/communicator.rb:215:in `block in execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/communicators/ssh/communicator.rb:312:in `connect'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/communicators/ssh/communicator.rb:209:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/docker/executor/vagrant.rb:32:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/docker/driver.rb:155:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/docker/driver.rb:81:in `running?'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/docker/driver.rb:61:in `state'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/docker/provider.rb:156:in `state'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:480:in `state'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/wait_for_communicator.rb:26:in `block in call'
或者,我只是得到了超时的错误,这意味着连接到机器需要很长时间。
我的设置:
Mac OSX 10.10.2 流浪汉1.7.2 VirtualBox 4.3.26
我尝试删除vb.has_ssh,但也没有运气。
感谢任何帮助!
答案 0 :(得分:0)
尝试将config.vm.boot_timeout值设置为高于默认值!