Testing Containers With Docker
Testing Containers With Docker
with
… A virtual machine
Example: When building the first iteration of our base testing image the file size was 1.7GB, which is huge by
Docker standards. Selenium’s own testing image ships at 1.3 GB.
Alpine Linux is kind of the standard for building a container from scratch and it ships at just under 50MB.
FROM debian:stable
RUN apt-get update && apt-get install -y --force-yes apache2
EXPOSE 80 443
VOLUME ["/var/www", "/var/log/apache2", "/etc/apache2"]
ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
What does the average Dockerfile look like?
Command to build our Docker Image
docker build -f /path/to/Dockerfile -t registry_name/image_name:version1.0.0 .
● You’ll notice that we are taking advantage of using the -f flag. This allows you to
specify a filename.
● The reason we need to do this is because Docker will only allow permissions to
copy files from the directory that the build is executed from.
● Something else you might notice is that we’re using the image registry
‘vidopsrig_registry’. This is a placeholder for now. We will need to consult with
Jeff Sutherland to determine whether or not we should post the image in the
group registry.
● For now, we can skip this step because we will be building new images frequently
until all development of automation is complete.
Running the container
● By default the image is currently set up to login to the Bash shell.
● All of the test automation repo files are copied into the /home folder
● Moving forward I would use our command line tool so that is executes on startup.
● There is potential to have a container for each test suite that executes once you spin up
the container.