Can not insert accents in MySQL REPL
I finally found a solution. The problem might be that I was setting utf8mb4 just for a database, not for the mysqld daemon.

Anyway I put here what I made. I first created a Dockerfile:

FROM mysql:latest

RUN apt-get update &amp;&amp; apt-get install -y locales &amp;&amp; rm -rf /var/lib/apt/lists/* \
  &amp;&amp; localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.utf8

COPY conf.d/ /etc/mysql/conf.d/

ENV MYSQL_ROOT_PASSWORD pass
ENV MYSQL_DATABASE gastos


As you can see, I copy a conf.d directory I just made. Inside this directory there is a character_set.cnf file:

[mysqld]
character_set_server = utf8mb4
collation_server = utf8mb4_general_ci