CircleCI2.0でPHPプロジェクトに対してCIを実行しようとしたとき、以下のように"image cache not found on this host, downloading circleci/php:7.1.5-browsers"エラーが出る場合があります。
Build-agent version 0.0.7546-3d4d9eb8 (2018-07-20T00:11:22+0000)
Starting container circleci/php:7.1.5-browsers
image cache not found on this host, downloading circleci/php:7.1.5-browsers
Error response from daemon: manifest for circleci/php:7.1.5-browsers not found
エラーの原因
これは、CircleCIに"circleci/php:7.1.5-browsers"というコンテナ(CIの実行環境)が存在しないためです。
プロジェクトを追加した直後に表示される.circleci/config.ymlファイルのサンプルをみると、以下のように前述のコンテナ名が記載されているのですが、情報が古いためそのままコピーして実行するとエラーになってしまいます。
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/php:7.1.5-browsers
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mysql:9.4
working_directory: ~/repo
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "composer.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: composer install -n --prefer-dist
- save_cache:
paths:
- ./vendor
key: v1-dependencies-{{ checksum "composer.json" }}
# run tests!
- run: phpunit
対処方法
対処法としては、imageを存在するコンテナ名に変更すれば良いです。php7.1環境でCIを回したい場合は、以下のように変更すると動作します。
- image: circleci/php:7.1.5-browsers
↓
- image: circleci/php:7.1-browsers
こちらもおススメ