Can't create a Docker container with a volume mounted from a user-created directory in the root of an ubuntu host (EC2)

Note: This answer applies only to Ubuntu (and to some extent derivative distributions). It should not be applied to any other distro.

The root cause of the problem is that you have installed and run Docker as a snap, and most people should not run it this way. When a program confined by snap starts, snapd creates a container to run the program in, and only files which were accessible when the program was started will be accessible to the program. This includes your new directory /data, which does not exist in the snap container docker is running in, which is why docker tries (and fails) to create it.

The version of docker shipped with Ubuntu itself also should not be used, as it is not kept up to date. (They really ought to either keep it updated or drop it entirely, but don't count on either happening any time soon.)

Most people should use Docker from the official Docker repos to avoid a wide variety of issues that crop up with Ubuntu's docker packages.