Creating a custom image.

1.1K    Asked by JoanGill in Devops , Asked on Nov 22, 2019
Answered by Joan Gill

There are 2 ways of creating a custom image.

By making changes within running container

Via docker compose file, in which the changes will be made within the commands written in file.

Let’s use docker exec command to get inside a running container.

Docker exec - it /bin/bash

Let’s say we have a container running with nginx and php, and we’ll add simple php.info file to create a test that its running perfectly fine. After which we’ll save the changes and create a custom image so that when we deploy it again simply browsing the url will phpinfo page.

After entering into container, let’s create php.info file within the doc root of nginx

vim phpinfo.php

adding phpinfo function -


Your Answer

Interviews

Parent Categories