简体   繁体   中英

Create new docker container with composer 2.0 installed

I am very new to docker and laradock, but I am trying to figure out how to create a new container that comes with composer 2.0 (or latest) installed automatically? How do I tell Laradock that I want the latest composer upon build/creation of the container?

I have followed several tutorials and several posts about this type of situation...however, nothing has panned out. If I build the container, and start the workspace bash, it comes up with composer 1.10 every time. I can update it from within the container, but I would prefer to have it installed by default, when the container is created. Thanks in advance.

You have a few options. Two that spring to mind are:

  1. You can use the RUN command in your docker file to run pretty much any commands you like. So you could in theory install composer this way.

  2. You can manually install composer and then build a new image. The new image will contain the composer install. You then push that to your repo of choice and use it as the base image in your dockerfile. This is quite common practice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM