Running the docker-compose start command, via the Linux command line, the project is built and started correctly, but in the pipeline that I have built when running docker-compose up the following error occurs
ERROR: for php Cannot start service php: driver failed programming external connectivity on endpoint bcc1dda8781b_ngweb-php-1 (58165db54561cd3ea0a34d3af1721084966d02b48a242321409840e25f109b9b): Error starting userland proxy: listen tcp4 0.0.0.0:443: bind: address already in
Does anyone have any idea what it could be?
Below are the docker-compose and Jenkinsfile files.
docker-compose.yaml
version: "3.1"
services:
ngwebsite:
image: jceleste/ngweb:115
networks:
- mysql_server
ports:
- 8282:80
depends_on:
- db
links:
- db
db:
image: mysql:5.7
networks:
- mysql_server
command: --innodb_use_native_aio=0
restart: always
volumes:
- db_data:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=*******
- MYSQL_DATABASE=ngweb
ports:
- 3302:3306
volumes:
db_data:
networks:
mysql_server:
Jenkinsfile
pipeline {
agent any
environment {
registry = "jceleste/ngweb"
dockerImage = ''
tag_version = "${env.BUILD_ID}"
tag_generic = '{{TAG}}'
}
stages {
stage ('Build Docker Image'){
steps{
script {
dockerapp = docker.build("jceleste/ngweb:${env.BUILD_ID}", '-f ./Dockerfile ./ ')
}
}
}
stage ('Push Docker Image'){
steps {
script {
docker.withRegistry('https://registry.hub.docker.com/','dockerhub'){
dockerapp.push("${env.BUILD_ID}")
}
}
}
}
stage ('Deploy Docker Image'){
steps{
script {
sh 'sed -i "s/{{TAG}}/$tag_version/g" /home/ngweb-compose/docker-compose.yaml'
sh 'docker-compose start'
sh 'sed -i "s/$tag_version/$tag_generic/g" /home/ngweb-compose/docker-compose.yaml'
}
}
}
}
}
That the pipeline correctly builds and starts the docker image
2
Answers
Thanks for the answer
I was confused, the docker-compose command was being executed on the docker-composer.yaml configuration that is on github, and in this file there was a reference to port 443
As its been pointed out in the comment above, check your existing services or applications using port 443 on your host machine. Since you are using linux, use
sudo lsof -i :443
to check for specific process using port 443. Stop the process if you can to free port or change port your compose file. I am assuming your webserver is running on Nginx.So, i would change my docker-compose.yaml to
you can run
docker-compose up -d
to start your services with the updated port mapping.However, I am curious why your image is tagged
<115>
but different in Jenkinsfile. I would suppose you’d match them.