What I was addicted to when updating the PHP version of the development environment (Docker) from 7.2.11 to 7.4.x

I decided to edit the existing Dockerfile to update the PHP version of the development environment from 7.2.11 to 7.4.x.

What I wanted to achieve

Update the PHP version of the development environment (Docker) from 7.2.11 to 7.4.x.


# Dockerfile

#↓ 7 this.4.I want to x
FROM php:7.2.11-apache 

RUN apt-get update \
&& apt-get install -y zlib1g-dev \
&& docker-php-ext-install zip \
&& apt-get install -y unzip

Conclusion

Eventually it became this shape.

# Dockerfile

FROM php:7.4.13-apache

RUN apt-get update \
&& apt-get install -y zlib1g-dev \
&& apt-get install -y libzip-dev \
&& docker-php-ext-install zip \
&& apt-get install -y unzip

What i did

Looking at Docker Hub, I had an image of 7.4.13-apache, so I changed it for the time being.


# Dockerfile

# ↓7.4.Changed to 13
FROM php:7.4.13-apache

RUN apt-get update \
&& apt-get install -y zlib1g-dev \
&& docker-php-ext-install zip \
&& apt-get install -y unzip

However. .. ..

$ docker-compose build
...
Abbreviation
...
configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:

No package 'libzip' found
No package 'libzip' found
No package 'libzip' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBZIP_CFLAGS
and LIBZIP_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
ERROR: Service 'service_name' failed to build : The command '/bin/sh -c apt-get update && apt-get install -y zlib1g-dev && docker-php-ext-install zip && apt-get install -y unzip' returned a non-zero code: 1

There seems to be no such thing as libzip ... So I added apt-get install libzip-dev.

FROM php:7.4.13-apache

# zlib zip unzip
RUN apt-get update \
&& apt-get install -y zlib1g-dev \
&& apt-get install libzip-dev \
&& docker-php-ext-install zip \
&& apt-get install -y unzip

Then ...

$ docker-compose build
...
Abbreviation
...
The following package was automatically installed and is no longer required:
  sensible-utils
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
  libzip4
The following NEW packages will be installed:
  libzip-dev libzip4
0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
Need to get 209 kB of archives.
After this operation, 436 kB of additional disk space will be used.
Do you want to continue? [Y/n] Abort.

Does that mean there is no -y option? so,

# Dockerfile

FROM php:7.4.13-apache

RUN apt-get update \
&& apt-get install -y zlib1g-dev \
&& apt-get install -y libzip-dev \
&& docker-php-ext-install zip \
&& apt-get install -y unzip

Add the -y option and run $ docker-compose build again.

$ docker-compose build
...
Abbreviation
...
Successfully built ******
Successfully tagged app_name:latest

I did well! !!

Reference article

stack oveflow Installing PHP-zip on a php:7.4-fpm image

Recommended Posts

What I was addicted to when updating the PHP version of the development environment (Docker) from 7.2.11 to 7.4.x
Problems I was addicted to when building the digdag environment with docker
What I was addicted to when introducing the JNI library
What I fixed when updating to Spring Boot 1.5.12 ・ What I was addicted to
I was addicted to the API version min23 setting of registerTorchCallback
Memorandum: What I was addicted to when I hit the accounting freee API
I had to lower the PHP version in Docker + Composer + Laravel environment
I was addicted to not being able to connect to AWS-S3 from the Docker container
I was addicted to the record of the associated model
What I did in the version upgrade from Ruby 2.5.2 to 2.7.1
I was addicted to the setting of laradock + VSCode + xdebug
What I was addicted to with the Redmine REST API
I tried to build the environment of WSL2 + Docker + VSCode
The story I was addicted to when setting up STS
What to do when ‘Could not find’ in any of the sources appears in the development environment with Docker × Rails × RSpec
I was addicted to WSl when trying to build an android application development environment with Vue.js
I tried to build the environment of PlantUML Server with Docker
What I was addicted to when implementing google authentication with rails
I was addicted to the roll method
I was addicted to the Spring-Batch test
[Rails] I was addicted to the nginx settings when using Action Cable.
Recorded because I was addicted to the standard input of the Scanner class
[CircleCI] I was addicted to the automatic test of CircleCI (rails + mysql) [Memo]
I tried migrating the portfolio created on Vagrant to the Docker development environment
When I tried to build an environment of PHP7.4 + Apache + MySQL with Docker, I got stuck [Windows & Mac]
[Rails] I tried to raise the Rails version from 5.0 to 5.2
Improve the performance of your Docker development environment
Summary of moss when updating from JMockit 1.4 to 1.30
What I tried when I wanted to get all the fields of a bean
Introduce Docker to the development environment and test environment of existing Rails and MySQL applications
[Updating] It was difficult to upgrade from httpclient 3.x series to 4.5, so I will write a summary of changes
What I did when I was addicted to the error "Could not find XXX in any of the sources" when I added a Gem and built it
I was addicted to the NoSuchMethodError in Cloud Endpoints
What I was addicted to when developing a Spring Boot application with VS Code
I tried to summarize the state transition of docker
Docker the development environment of Ruby on Rails project
About the solution of the error that occurred when trying to create a Japanese file of devise in the Docker development environment
The part I was addicted to in "Introduction to Ajax in Java Web Applications" of NetBeans
A memorandum because I was addicted to the setting of the Android project of IntelliJ IDEA
Debug the VSCode + Docker + PHP development environment with XDebug.
What I was addicted to when trying to properly openAPI/Swagger documentation with Rails + Grape + Grape Swagger
I tried using Docker because I don't want to pollute the local environment in Microsoft Teams tab development of MS Learn
The story of migrating a stray batch without an owner from EC2 to a Docker environment
When I started ansible + docker now, I stumbled from the beginning, but I managed to start it
I want to recreate the contents of assets from scratch in the environment built with capistrano
I can't find the docker image after updating to docker desktop 2.4.0.0
Install by specifying the version of Django in the Docker environment
What I was addicted to while using rspec on rails
[Docker] List of errors that occurred when building the environment
I was addicted to looping the Update statement on MyBatis
I tried to build the environment little by little using docker
I want to narrow down the display of docker ps
I tried to create a padrino development environment with Docker
One file of Docker x Laravel threat! Build a local development environment with the minimum configuration
Know the convenience of Docker (-compose) now (information list that I referred to when using it)
[Programming beginner] What to do when rails s becomes an error in the local development environment
I tried to take a look at the flow of Android development environment construction with Android Studio
[Be careful about changing the version of Xdebug! ] Create a development environment with Xdebug3 + docker + VS Code
I tried to summarize what was asked at the site-java edition-
A note when I was addicted to converting Ubuntu on WSL1 to WSL2
If you want to change the Java development environment from Eclipse