Run selenium in the host with docker and Capybara - selenium

I have tests with capybara in a docker container. I use this to setup selenium :
Capybara.register_driver :selenium do |app|
require 'selenium/webdriver'
Selenium::WebDriver::Firefox::Binary.path = ENV['FIREFOX_BINARY_PATH'] || Selenium::WebDriver::Firefox::Binary.path
Capybara::Selenium::Driver.new(app, :browser => :firefox)
end
It work when we run tests with xvfb but I want to see the real browser when tests are running so I'm looking for a way to use the browser in the host.
I think it's possible to launch geckodriver on the host and share the port 4444 but I didn't succeeded yet. Capybara launch a new instance of geckodriver, on the container, each time.
What can I do?
Edit 1 : Add more info
I all config I have for capybara :
#<Capybara::SessionConfig:0x0055ce67731a00
#always_include_port=false,
#app_host="http://domain-test.engagement.lvh.me:1300",
#automatic_label_click=false,
#automatic_reload=true,
#default_host="http://www.example.com",
#default_max_wait_time=5,
#default_selector=:css,
#enable_aria_label=false,
#exact=false,
#exact_text=false,
#ignore_hidden_elements=true,
#match=:smart,
#raise_server_errors=true,
#run_server=true,
#save_path=#<Pathname:/app/tmp/capybara>,
#server_errors=[StandardError],
#server_host=nil,
#server_port=1300,
#visible_text_only=false,
#wait_on_first_by_default=false>
Here is my docker-compose file :
version: '3'
services:
web:
build: .
command: rails s -b 0.0.0.0
working_dir: /app
volumes:
- .:/app
- ./tmp/bundle:/usr/local/bundle
- $SSH_AUTH_SOCK:/ssh-agent
environment:
- BUNDLE_JOBS=4
- SSH_AUTH_SOCK=/ssh-agent
- MONGO_HOST=mongo
- REDIS_HOST=redis
- MEMCACHE_HOST=memcache
ports:
- "80:3000"
- "1300:1300"
links:
- mongo
- redis
- memcache
mongo:
image: mongo:3.4.9
volumes:
- ~/data/mongo/db:/data/db
redis:
image: redis:2.8.17
volumes:
- ~/data/redis:/data
memcache:
image: memcached:1.5-alpine
And finally my Dockerfile :
FROM ruby:2.3.1
RUN apt-get update && apt-get install -y build-essential qt5-default \
libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x \
xvfb rsync
ARG GECKODRIVER_VERSION=0.19.0
RUN wget --no-verbose -O /tmp/geckodriver.tar.gz https://github.com/mozilla/geckodriver/releases/download/v$GECKODRIVER_VERSION/geckodriver-v$GECKODRIVER_VERSION-linux64.tar.gz \
&& rm -rf /opt/geckodriver \
&& tar -C /opt -zxf /tmp/geckodriver.tar.gz \
&& rm /tmp/geckodriver.tar.gz \
&& mv /opt/geckodriver /opt/geckodriver-$GECKODRIVER_VERSION \
&& chmod 755 /opt/geckodriver-$GECKODRIVER_VERSION \
&& ln -fs /opt/geckodriver-$GECKODRIVER_VERSION /usr/bin/geckodriver
RUN apt-get install -y libgtk-3-dev \
&& wget --no-verbose https://ftp.mozilla.org/pub/firefox/releases/56.0/linux-x86_64/en-US/firefox-56.0.tar.bz2 \
&& tar -xjf firefox-56.0.tar.bz2 \
&& mv firefox /opt/firefox56 \
&& ln -s /opt/firefox56/firefox /usr/bin/firefox
ENV TZ Europe/Paris
RUN echo $TZ > /etc/timezone && \
apt-get update && apt-get install -y tzdata && \
dpkg-reconfigure -f noninteractive tzdata && \
apt-get clean
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6 && \
echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list && \
apt-get update && \
apt-get install -y mongodb-org
RUN gem install bundler
RUN mkdir /app
WORKDIR /app

In order to get Selenium to use a remote geckodriver instance you need to provide the url option to it.
Capybara.register_driver :selenium do |app|
require 'selenium/webdriver'
Capybara::Selenium::Driver.new(app, :browser => :firefox, url: 'http://<your ip as reachable from docker>:<port geckodriver is available on>')
end
This will then require you to run geckodriver on the machine your want firefox to run on, possibly using the --binary option to specify where firefox is located. It will also probably require setting Capybara.app_host (and possibly Capybara.always_include_port depending on your exact configuration) so the browser requests are routed back to the app under test running on the docker instance.
Another thing to consider is that the AUT will need to be bound to an interface on the docker instance which is reachable from the host. By default Capybara binds to the 127.0.0.1 interface which probably isn't reachable, so you can set Capybara.server = '0.0.0.0' to bind to all available interfaces, or specify the specific external interface.

Related

How to Fix " org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: crashed" in docker container

I am trying to build a docker image for my selenium tests. However i keep getting error message " org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: crashed" .
Please do not mark this as Duplicate ,though I have referred to a lot of answers provided in the links below. I am still not able to get through this. I have tried all the answers that are provided but no luck .
Selenium: WebDriverException:Chrome failed to start: crashed as google-chrome is no longer running so ChromeDriver is assuming that Chrome has crashed
WebDriverException: unknown error: DevToolsActivePort file doesn't exist while trying to initiate Chrome Browser
Please find the docker file code and my selenium code.
Docker file code looks like this :
FROM selenium/standalone-chrome
FROM gradle
RUN gradle wrapper
USER root
RUN apt-get update; apt-get -y install wget gnupg2
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub |
apt-key add -
RUN echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable
main" >> /etc/apt/sources.list.d/google-chrome.list
RUN apt-get update; apt-get -y install google-chrome-stable
COPY . /project
RUN chown -R gradle:gradle /project
RUN wget -N
http://chromedriver.storage.googleapis.com/76.0.3809.25/chromedriver_linux64.zip -P ~/
RUN unzip ~/chromedriver_linux64.zip -d ~/
RUN rm ~/chromedriver_linux64.zip
RUN mv -f ~/chromedriver /project/executables/chromedriver
RUN chown gradle:gradle /project/executables/chromedriver
RUN chmod 0755 /project/executables/chromedriver
USER gradle
WORKDIR /project
ENV GRADLE_USER_HOME /project/.gradle_home
CMD gradle build --info
Selenium code :
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--headless");
chromeOptions.addArguments("start-maximized"); // open Browser in maximized mode
chromeOptions.addArguments("disable-infobars"); // disabling infobars
chromeOptions.addArguments("--disable-extensions"); // disabling extensions
chromeOptions.addArguments("--disable-gpu"); // applicable to windows os only
chromeOptions.addArguments("--disable-dev-shm-usage"); // overcome limited resource problems
chromeOptions.addArguments("--no-sandbox"); // Bypass OS security model
System.setProperty("webdriver.chrome.driver","executables/chromedriver");
Webdriver driver = new ChromeDriver(chromeOptions);
driver.get("http://google.com");
As you can see from the error message the chrome is starting at default location(usr/bin/google-chrome) but it is crashing .
Starting ChromeDriver 76.0.3809.25 (a0c95f440512e06df1c9c206f2d79cc20be18bb1-refs/branch-heads/3809#{#271}) on port 30275
Only local connections are allowed.
" org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: crashed" .
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
System info: host: 'd2e61fa0170d', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.125-linuxkit', java.version: '1.8.0_212'
Driver info: driver.version: ChromeDriver
I am using latest chrome driver 76.0.3809.25. I am assuming that latest google chrome is fetched and installed
Any help is appreciated
Seems like you are having issues with installing google chrome and its driver. Sharing you my Dockerfile and Docker-compose.yml. I achieved this using python. It also has the example for Firefox and PhantomJS.
FROM ubuntu:bionic
RUN apt-get update && apt-get install -y \
python3 python3-pip \
fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 \
libnspr4 libnss3 lsb-release xdg-utils libxss1 libdbus-glib-1-2 \
curl unzip wget \
xvfb
# install geckodriver and firefox
RUN GECKODRIVER_VERSION=`curl https://github.com/mozilla/geckodriver/releases/latest | grep -Po 'v[0-9]+.[0-9]+.[0-9]+'` && \
wget https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-linux64.tar.gz && \
tar -zxf geckodriver-$GECKODRIVER_VERSION-linux64.tar.gz -C /usr/local/bin && \
chmod +x /usr/local/bin/geckodriver && \
rm geckodriver-$GECKODRIVER_VERSION-linux64.tar.gz
RUN FIREFOX_SETUP=firefox-setup.tar.bz2 && \
apt-get purge firefox && \
wget -O $FIREFOX_SETUP "https://download.mozilla.org/?product=firefox-latest&os=linux64" && \
tar xjf $FIREFOX_SETUP -C /opt/ && \
ln -s /opt/firefox/firefox /usr/bin/firefox && \
rm $FIREFOX_SETUP
# install chromedriver and google-chrome
RUN CHROMEDRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` && \
wget https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip && \
unzip chromedriver_linux64.zip -d /usr/bin && \
chmod +x /usr/bin/chromedriver && \
rm chromedriver_linux64.zip
RUN CHROME_SETUP=google-chrome.deb && \
wget -O $CHROME_SETUP "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" && \
dpkg -i $CHROME_SETUP && \
apt-get install -y -f && \
rm $CHROME_SETUP
# install phantomjs
RUN wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 && \
tar -jxf phantomjs-2.1.1-linux-x86_64.tar.bz2 && \
cp phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs && \
rm phantomjs-2.1.1-linux-x86_64.tar.bz2
RUN pip3 install selenium
RUN pip3 install pyvirtualdisplay
RUN pip3 install Selenium-Screenshot
RUN pip3 install requests
RUN pip3 install pytest
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV PYTHONUNBUFFERED=1
ENV APP_HOME /usr/src/app
WORKDIR /$APP_HOME
COPY . $APP_HOME/
CMD tail -f /dev/null
CMD python3 example.py
Docker-compose.yml
selenium:
build: .
ports:
- 4000:4000
- 443:443
volumes:
- ./data/:/data/
privileged: true

apache2 service status in Docker container

My Dockerfile as follow:
FROM php:7.2-apache
#install some basic tools
RUN apt-get -dd clean && apt-get -dd update && apt-get install -y \
git \
tree \
vim \
wget \
iputils-ping \
mysql-client \
subversion
#install some base extensions
RUN apt-get install -y \
libzip-dev \
libicu-dev \
zip \
&& docker-php-ext-configure zip --with-libzip \
&& docker-php-ext-configure intl \
&& docker-php-ext-install zip intl opcache pdo_mysql mysqli
#setup composer
RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/ \
&& ln -s /usr/local/bin/composer.phar /usr/local/bin/composer
WORKDIR /var/www/app
EXPOSE 80
RUN a2enmod rewrite
After I compose above image with mysql I start server e.g
docker-compose up -d
And access the container by:
docker exec -it php_web_1 bash
Then I check the apache2 service status:
service apache2 status
[FAIL] apache2 is not running ... failed!
If I just run command : apache2
httpd (pid 1) already running
service apache2 start/stop does not have any effect on apache2 status.
What is the difference b/w both ways and why service apache2 start/stop is not working ?
If you look at the Dockerfile for the php:7.2-apache base image, you would see the CMD ["apache2-foreground"] which runs a script located in /usr/local/bin/ directory to run the Apache server upon the container startup. If you set an interactive session with the base image and run the SysVInit commands like service apache2 start, this will start the Apache service within the container which was stopped when you made the session.
In your case, try running the script in the Dockerfile located in the /usr/local/bin/ directory as the CMD command and re-run docker-compose up -d to see if the Apache is started or not.

Add Ruby SDK from Docker container as a remote SDK on RubyMine

Rubymine has options to add remote sdks using Vagrant and SSH, however I decided to go with Docker. I already created a Ruby container, but I don't know how to enable SSH access to it so Rubymine can set it as the remote SDK.
Is it possible?
Tried to follow this article, but the Ruby image doesn't have yum and this package epel-release is for Fedora/RedHat.
Hey are you using this official Ruby docker image?
If so, it's based on Debian and you'll have to use apt-get to install packages.
Here's a handy script for installing openssh-server and configuring a user in a Dockerfile:
FROM ruby:2.1.9
#======================
# Install OpenSSH server (sshd)
#======================
RUN apt-get update -qqy \
&& apt-get -qqy install \
openssh-server \
&& echo "PidFile ${RUN_DIR}/sshd.pid" >> /etc/ssh/sshd_config \
&& sed -i 's|session required pam_loginuid.so|session optional pam_loginuid.so|g' /etc/pam.d/sshd \
&& mkdir -p /var/run/sshd \
&& rm -rf /var/lib/apt/lists/*
# Add user rubymine with password rubymine and give ownership of rubymine home dir
RUN adduser --quiet rubymine \
&& echo "rubymine:rubymine" | chpasswd \
&& chown -R rubymine:rubymine /home/rubymine \
EXPOSE 22
I'm not sure of what are the exact configurations you can perform with Rubymine. But it's possible to open a tty with the container without the need of ssh:
#run it as a daemon
docker run -d --name=myruby ruby:2.19
#connect to it
docker -it exec myruby /bin/bash
UPDATE:
Try setting DOCKER_HOST environment variable to listen on a tcp port:
export DOCKER_HOST='tcp://localhost:2376'

Docker Container from php:5.6-apache as root

This would be related to Docker php:5.6-Apache Development Environment missing permissions on volume mount
I have tried pretty much everything to make the mounted volume be readable by www-data, my current solution is trying to move by scripts the folders needed by the application to /var and giving the proper permissions to be writable by www-data but that is becoming hard to maintain.
Giving the fact that it's a development environment I don't mind being a security hole so I would like to run apache as root and I get
Error: Apache has not been designed to serve pages while running as
root. There are known race conditions that will allow any local user
to read any file on the system. If you still desire to serve pages as
root then add -DBIG_SECURITY_HOLE to the CFLAGS line in your
src/Configuration file and rebuild the server. It is strongly
suggested that you instead modify the User directive in your
httpd.conf file to list a non-root user.
Is there any easy way I can accomplish this using the docker image php:5.6-apache?
This is my docker-compose.yml
version: '2'
services:
api:
container_name: api
privileged: true
build:
context: .
dockerfile: apigility/Dockerfile
ports:
- "2020:80"
volumes:
- /ft/code/api:/var/www:rw
And this is my Dockerfile:
FROM php:5.6-apache
USER root
RUN apt-get update \
&& apt-get install -y sudo openjdk-7-jdk \
&& echo "www-data ALL=NOPASSWD: ALL" >> /etc/sudoers
RUN apt-get install -y git zlib1g-dev libmcrypt-dev nano vim --no-install-recommends \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/* \
&& docker-php-ext-install mcrypt zip \
&& curl -sS https://getcomposer.org/installer \
| php -- --install-dir=/usr/local/bin --filename=composer \
&& a2enmod rewrite \
&& sed -i 's!/var/www/html!/var/www/public!g' /etc/apache2/apache2.conf \
&& echo "AllowEncodedSlashes On" >> /etc/apache2/apache2.conf \
&& cp /usr/src/php/php.ini-production /usr/local/etc/php/php.ini \
&& printf '[Date]\ndate.timezone=UTC' > /usr/local/etc/php/conf.d/timezone.ini
WORKDIR /var/www
Why not to do exactly what it says in the question you referred to?
RUN usermod -u 1000 www-data
RUN groupmod -g 1000 www-data
This is not a hack. It's a proper solution to the problem you have in the development environment.
So, I managed to make the mounted data available for www-data by using the part of the answer in the related post but another step is required for it to work.
After you run docker-machine start default you need to ssh into it and run the following:
sudo mkdir --parents /code [where /code is the shared folder in virtualbox]
sudo mount -t vboxsf -o uid=999,gid=999 code /code [this is to make sure the uid and gid is 999 for the next part to work]
Then in your Dockerfile add
RUN usermod -u 999 www-data \
&& groupmod -g 999 www-data
After it's mounted, /code will have the owner www-data, and problem solved!
Another and better solution.
Add this in your dockerfile
RUN cd ~ \
&& apt-get -y install dpkg-dev debhelper libaprutil1-dev libapr1-dev libpcre3-dev liblua5.1-0-dev autotools-dev \
&& apt-get source apache2.2-common \
&& cd apache2-2.4.10 \
&& export DEB_CFLAGS_SET="-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -DBIG_SECURITY_HOLE" \
&& dpkg-buildpackage -b \
&& cd .. \
&& dpkg -i apache2-bin_2.4.10-10+deb8u7_amd64.deb \
&& dpkg -i apache2.2-common_2.4.10-10+deb8u7_amd64.deb
After that, you could be able to run apache as root.
PS : apache2-2.4.10, apache2-bin_2.4.10-10+deb8u7_amd64.deb and apache2.2-common_2.4.10-10+deb8u7_amd64.deb could change according to your source

Ambari 2.2 - exiting with non-zero status code on Ubuntu 14.04 Docker container

TL;DR - Dockerized Ambari on Ubuntu 14.04 Docker container throws error upon startup with default configurations
I'm attempting to Dockerize an Ambari deployment to support running it along side my Hadoop containers. Here is my Dockerfile:
FROM ubuntu:14.04
ENV AMBARI_HOME /opt/ambari
ENV AMBARI_VERSION 2.2.0.0
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get -y install wget software-properties-common python-software-properties openssh-client openssh-server
# Install Java.
RUN \
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
add-apt-repository -y ppa:webupd8team/java && \
apt-get update && \
apt-get install -y oracle-java8-installer && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/oracle-jdk8-installer
# Define commonly used JAVA_HOME variable
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
RUN mkdir -p "$AMBARI_HOME"
WORKDIR $AMBARI_HOME
# passwordless ssh
RUN export DEBIAN_FRONTEND=noninteractive \
&& echo -e 'y\n'|ssh-keygen -q -t rsa -N "" -f /root/.ssh/id_rsa \
&& cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
RUN export DEBIAN_FRONTEND=noninteractive \
&& wget -nv http://public-repo-1.hortonworks.com/ambari/ubuntu14/2.x/updates/2.2.0.0/ambari.list -O /etc/apt/sources.list.d/ambari.list \
&& apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD \
&& apt-get update \
&& apt-get -y install ambari-server
#Disable SELinux
RUN echo SELINUX=disabled >> /etc/selinux/config
EXPOSE 8080
RUN ambari-server setup -s --verbose --java-home $JAVA_HOME
CMD ambari-server start
When I start the container I get the following error -
Using python /usr/bin/python2
Starting ambari-server
Ambari Server running with administrator privileges.
About to start PostgreSQL
Organizing resource files at /var/lib/ambari-server/resources...
WARNING: setpgid(73, 0) failed - [Errno 13] Permission denied
Server PID at: /var/run/ambari-server/ambari-server.pid
Server out at: /var/log/ambari-server/ambari-server.out
Server log at: /var/log/ambari-server/ambari-server.log
Waiting for server start.........
ERROR: Exiting with exit code -1.
REASON: Ambari Server java process died with exitcode -1. Check /var/log/ambari-server/ambari-server.out for more information.
There doesn't seem to be anything useful in the ambari-server.log or .out
I found an issue for WARNING: setpgid(73, 0) failed - [Errno 13] Permission denied fixed here: setpgid issue
From reading the HortonWorks docs for deploying to Ubuntu 14.04, this should work:
Install Ambari on Ubuntu 14.04
I've tried to deploy with the embedded Postges as well as an external one with the same results.
One interesting note is that even with the error, Ambari appears to be up and I can login as the default admin/admin, but when calling `ambari-server stop' it says no process is running...
root#3e6d778b43f8:/opt/ambari# ambari-server stop
Using python /usr/bin/python2
Stopping ambari-server
Ambari Server is not running
root#3e6d778b43f8:/opt/ambari# jps
868 AmbariServer
955 Jps
I'll replicate this setup on my Ubuntu box tomorrow and see if the same thing happens.
Thanks!
Edit #1: docker info
vagrant#vagrant-ubuntu-trusty-64:/vagrant/scripts$ docker info
Containers: 14
Images: 161
Server Version: 1.9.1
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 189
Dirperm1 Supported: false
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.13.0-44-generic
Operating System: Ubuntu 14.04.1 LTS
CPUs: 1
Total Memory: 3.861 GiB
Name: vagrant-ubuntu-trusty-64
ID: 7AD6:Z5TH:76NW:G54B:IHVK:PWKP:E2LI:CRPI:MIGM:STJU:3D2B:K7EQ
WARNING: No swap limit support
vagrant#vagrant-ubuntu-trusty-64:/vagrant/scripts$ docker version
Client:
Version: 1.9.1
API version: 1.21
Go version: go1.4.2
Git commit: a34a1d5
Built: Fri Nov 20 13:12:04 UTC 2015
OS/Arch: linux/amd64
Server:
Version: 1.9.1
API version: 1.21
Go version: go1.4.2
Git commit: a34a1d5
Built: Fri Nov 20 13:12:04 UTC 2015
OS/Arch: linux/amd64
docker is running inside of a Vagrant Virtualbox instance (v1.8.1)
I had same problem with ambari-server inside docker on ubuntu 14.04. Could you try the following
Workaround the aufs problem
Inside /etc/default/docker add
DOCKER_OPTS="--storage-driver=devicemapper"
and restart the docker service. Note that after this all your images will disappear (http://muehe.org/posts/switching-docker-from-aufs-to-devicemapper/). Rebuild your images.
To be honest I'm not 100% sure if this part is really needed.
After switching from aufs to devicemapper you might get the following error:
ERROR: Could not find container for entity id
The solution was to remove the old AUFS db and any existing containers:
sudo rm -rf /var/lib/docker/containers/*
sudo rm -rf /var/lib/docker/linkgraph.db
Restarting your docker images/containers should now work on the devicemapper engine.
Put apparmor into complain mode for docker
Inside /etc/apparmor.d/docker comment out (#) line deny #{PROC}/{*,**^[0-9*],sys/kernel/shm*} wkx,, it somehow confuses apparmor utils. Than run
sudo aa-complain /etc/apparmor.d/docker
If aa-complain throws command not found, install:
sudo apt-get install apparmor-utils
After starting the container ambari-server started working for me.
I dont know how docker relies here on apparmor, i.e. what risks the operation above introduces...
It looks like there's an issue deploying Ambari to a docker container.. I broke it out and installed it onto a Vagrant 14.04 Ubuntu VM wit the following scripts:
install_java.sh
#!/bin/bash
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
add-apt-repository -y ppa:webupd8team/java && \
apt-get update && \
apt-get install -y oracle-java8-installer && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/oracle-jdk8-installer
install_ambari.sh
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive \
&& wget -nv http://public-repo-1.hortonworks.com/ambari/ubuntu14/2.x/updates/2.2.0.0/ambari.list -O /etc/apt/sources.list.d/ambari.list \
&& apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD \
&& apt-get update \
&& apt-get -y install ambari-server
Followed by:
sudo ambari-server setup -s -v -j $JAVA_HOME
sudo ambari-server start -v
#thaJeztah - what do I need to fix with my Dockerfile setup?