util-docker: Use python3 by default for Ubuntu 18.04 docker images

gem5 dropped the support for python2. This change sets python3
to have a higher priority than python2 in the Ubuntu 18.04 docker
images. This is done so that gem5 will be compiled and tested
in the python3 environment by default.

JIRA: https://gem5.atlassian.net/browse/GEM5-958

Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Change-Id: I11ffb06697ecf4cebf9f98b611641faa42805547
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45125
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45826
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
diff --git a/util/dockerfiles/ubuntu-18.04_all-dependencies/Dockerfile b/util/dockerfiles/ubuntu-18.04_all-dependencies/Dockerfile
index 2403a50..775e549 100644
--- a/util/dockerfiles/ubuntu-18.04_all-dependencies/Dockerfile
+++ b/util/dockerfiles/ubuntu-18.04_all-dependencies/Dockerfile
@@ -32,3 +32,6 @@
     libprotobuf-dev protobuf-compiler libprotoc-dev libgoogle-perftools-dev \
     python3-dev python3 python3-six doxygen libboost-all-dev \
     libhdf5-serial-dev python3-pydot libpng-dev libelf-dev pkg-config
+
+RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10
+RUN update-alternatives --install /usr/bin/python python /usr/bin/python2 1
diff --git a/util/dockerfiles/ubuntu-18.04_min-dependencies/Dockerfile b/util/dockerfiles/ubuntu-18.04_min-dependencies/Dockerfile
index 5ec6784..53a7d92 100644
--- a/util/dockerfiles/ubuntu-18.04_min-dependencies/Dockerfile
+++ b/util/dockerfiles/ubuntu-18.04_min-dependencies/Dockerfile
@@ -30,3 +30,6 @@
 RUN apt -y upgrade
 RUN apt -y install build-essential scons zlib1g-dev m4 python3-dev python3 \
     python3-six
+
+RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10
+RUN update-alternatives --install /usr/bin/python python /usr/bin/python2 1