Understanding Jenkinsfile’s steps for Docker agent

I have Jenkinsfile with the following steps:

stage('build') {
      agent {
           docker {
               image 'maven:3-alpine'
               args '-v /ec2-user/.m2:/root/.m2'
      steps {
        git(url: 'https://github.com/user/project.git', branch: 'master')
        sh 'cp /home/application-prod.properties src/main/resources'
        sh 'mvn clean install'

According to docs, Jenkins should Execute the steps in this stage in a newly created container using this image.

If that is true, then why the second step’s sh command is executed successfully? How can it access the file on the Jenkins host?

To me, it looks like the commands are executed on the Jenkins host. Then why mvn clean install works fine? Jenkins host doesn’t have Maven installed.

Source: StackOverflow