20.5k views
2 votes
What directive in a Dockerfile would allow you to install packages to be included with the image during the build process?

A) RUN apt-get install
B) ADD package
C) INSTALL package
D) FROM package

User Kasmetski
by
7.3k points

1 Answer

3 votes

To install packages in a Dockerfile during the build process, use the directive RUN apt-get install, followed by the package names.

The directive in a Dockerfile that allows you to install packages during the image build process is A) RUN apt-get install. This directive is used to execute commands within the container. For example, if you want to install a package like curl, you would include a line in your Dockerfile such as RUN apt-get update && apt-get install -y curl. It's important to run apt-get update before installation commands to ensure that the package indices are updated.

User Savena
by
9.4k points