diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 65e9763d7639d0745c5d793f88322c13f0603f00..e6e53c49a853bff53a6a27356a3fcc817fc3ea76 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,12 +1,12 @@
-pycodestyle:
-  image: docker:stable
+flake8:
+  image: python:3-alpine
   tags:
     - docker
   before_script:
-    - apk add --no-cache py-pip
-    - pip install pycodestyle
+    - python -m pip install --upgrade pip
+    - pip3 install flake8
   script:
-    # Run pycodestyle (PEP8) check.
+    # Run flake8 (pycodestyle + pyflakes) check.
     # https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
     # Ignored errors:
     # - E128: continuation line under-indented for visual indent
@@ -14,4 +14,4 @@ pycodestyle:
     # - E731: do not assign a lambda expression, use a def
     # - W504: line break after binary operator (conflicts with old pep8 package)
     # - W505: doc line too long
-    - pycodestyle --ignore=E128,E501,E731,W504,W505 .
+    - flake8 --ignore=E128,E501,E731,W504,W505 .