Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Open a port in bitbucket pipelines

Tristan Wegman March 4, 2018

I have a mean stack project that is compiled and run with gulp. In bitbucket-pipelines.yml I setup a ubuntu image (same as on my production server), install my development dependencies and parse my config.js so it contains the localhosts ip-adress. This is all good.

Next I run a gulp-setup task, this task configures and runs a (docker) mongo-container (port:58002) and (docker) node-container(post:5800) based on the ip in config.js. This step fails:

[07:50:02] Error: connect ENOENT /var/run/docker.sock 
at Object.exports._errnoException (util.js:1020:11)

at exports._exceptionWithHostPort (util.js:1043:20)

at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)

The problem seems to be that the ports are not accessible. I tried to disable the firewall, 

- su -c "iptables -F"

But this gives me a root access problem. Here I get stuck. Is it possible to open a port? Is there a port that is already open? I would like to prevent having to run services because the Gulp setup allows me to easily run different test-plans, create dists etc.

Hope someone can point me in to the right direction.

image: ubuntu:17.10

pipelines:
default:
- step:
name: Setup Environment
script:
- echo "▂▃▅▇█▓▒░ installing shared requirements ░▒▓█▇▅▃▂"
- su -c "apt-get update"
- su -c "DEBIAN_FRONTEND=noninteractive apt-get -yq install nmap"
- nmap localhost
- su -c "DEBIAN_FRONTEND=noninteractive apt-get -yq install curl"
- su -c "DEBIAN_FRONTEND=noninteractive apt-get -yq install wget"
- su -c "DEBIAN_FRONTEND=noninteractive apt-get -yq install git"
- echo "▂▃▅▇█▓▒░ Installing Node.js 9 ░▒▓█▇▅▃▂"
- curl -sL https://deb.nodesource.com/setup_9.x
- su -c "apt-get install -y nodejs"
- node --version
- su -c "DEBIAN_FRONTEND=noninteractive apt-get -yq install npm"
- whereis npm
- echo "▂▃▅▇█▓▒░ Installing Docker ░▒▓█▇▅▃▂"
- wget "https://download.docker.com/linux/ubuntu/dists/artful/pool/stable/amd64/docker-ce_17.12.1~ce-0~ubuntu_amd64.deb"
- su -c "DEBIAN_FRONTEND=noninteractive apt-get -yq install iptables"
- su -c "DEBIAN_FRONTEND=noninteractive apt-get -yq install libdevmapper1.02.1"
- su -c "DEBIAN_FRONTEND=noninteractive apt-get -yq install libltdl7"
- su -c "DEBIAN_FRONTEND=noninteractive apt-get -yq install libseccomp2"
- su -c "dpkg -i docker-ce_17.12.1~ce-0~ubuntu_amd64.deb"
- su -c "iptables -F"
- docker --version
- echo "▂▃▅▇█▓▒░ Installing Build Tools ░▒▓█▇▅▃▂"
- npm install -g gulpjs/gulp.git#4.0 bower
- gulp --version
- bower --version
- echo "▂▃▅▇█▓▒░ installing application packages ░▒▓█▇▅▃▂"
- npm install
- echo "▂▃▅▇█▓▒░ setting up development environment ░▒▓█▇▅▃▂"
- su -c "DEBIAN_FRONTEND=noninteractive apt-get -yq install sed"
- hostname -I > local_ip
- sed -i "s/my_local_ip/`cat local_ip`/g" config.js
- cat config.js
- su -c "gulp setup"

1 answer

0 votes
Jeroen De Raedt
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 27, 2018

Hi @Tristan Wegman,

in order to interact with Docker, you should enable Docker. To do this, put this at the top/bottom of your YML file: 

options:
  docker: true 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events