Currently and any time soon docker do not support removing volumes, ports and other image properties.
There is no UNVOLUME and UNEXPOSE and UNSETENV.
Several workarounds exists
.
Edit image tar file
Just remove volumes from metadata. There even tool for that
https://github.com/gdraheim/docker-copyedit
multistage build
Copy content of original image, without metadata
Use next dockerfile
# Dockerfile
FROM mysql as orig
FROM ubuntu:bionic as image
# care must be taken, this will not preserve fs ownership
COPY --from=orig / / # this will copy all files, without metadata.
ENV ... # include all commands that are not file related
ENTRYPOINT ["docker-entrypoint.sh"]
EXPOSE 3306
CMD ["mysqld"]