我有php5.6-apache鏡像建立在ubuntu和mysql:5.6鏡像。我想從兩張圖像上面創建碼頭圖像,以便我可以使用gitlab ci中的新建圖像。我怎樣才能做到這一點?我對docker和gitlab相當陌生。用php和mysql創建docker鏡像
我在gitlab中試過,但沒有奏效。
image: viraths/php5.6-apache:latest
stages:
- build
- test
deps build:
stage: build
variables:
MYSQL_DATABASE: test
MYSQL_ROOT_PASSWORD: password
DNSDOCK_ALIAS: localhost
services:
- mysql:5.6
script:
- export APPLICATION_ENV=test
- if [ -f /.dockerinit ]; then export COMPOSER_HOME=/cache/composer; fi;
- php -v
- composer install --no-progress --no-interaction --prefer-dist
artifacts:
paths:
- vendor/
expire_in: 1 week
tags:
- docker
在gitlab ci中運行composer安裝時出現以下錯誤。
[Doctrine\DBAL\Exception\ConnectionException]
An exception occured in driver: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
你使用的是Linux嗎? –
@SoniVimal yes ubuntu willy – Viraths
也許對你有幫助:http://stackoverflow.com/questions/11990708/error-cant-connect-to-local-mysql-server-through-socket-var-run-mysqld-mysq –