title: How to update wordpress on docker
body: <p>I'm running a php-fpm wordpress container.</p>
  <p>The wordpress source files are mounted in a named volume &quot;wordpress&quot; shared with the Nginx container.</p>
  <p>Everything is running well except when i need to update wordpress to a new version. The code inside the named volume persists. It is normal for a named volume...</p>
  <p>I could manually delete the volume but there must be a better way.</p>
  <p>My dockerfile:</p>
  <pre><code>FROM wordpress:4.9.5-php5.6-fpm-alpine
  </code></pre>
  <p>My docker-compose.yml</p>
  <pre class="lang-yml prettyprint-override"><code>version: '3.1'
  
  services:
  
    php:
      build: ./docker/php/
      restart: unless-stopped
      volumes:
        - wordpress:/var/www/html
        - ./web/wp-content/:/var/www/html/wp-content/
        - ./web/wp-config.php:/var/www/html/wp-config.php
  
      environment:
        - DEBUG=${DEBUG:-0}
        - MYSQL_USER=$MYSQL_USER
        - MYSQL_PASSWORD=$MYSQL_PASSWORD
        - MYSQL_DATABASE=$MYSQL_DATABASE
  
    nginx:
      image: nginx:1-alpine
      restart: unless-stopped
      expose:
        - 80
      volumes:
        - wordpress:/var/www/html
        - ./web/wp-content/:/var/www/html/wp-content/
        - ./docker/nginx/site.conf:/etc/nginx/conf.d/default.conf
        - ./docker/nginx/wordpress.conf:/etc/nginx/wordpress.conf
      environment:
        - VIRTUAL_HOST=localhost
  
    mysql:
      image: mysql:5.6
      restart: unless-stopped
      environment:
        - MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD
        - MYSQL_USER=$MYSQL_USER
        - MYSQL_PASSWORD=$MYSQL_PASSWORD
        - MYSQL_DATABASE=$MYSQL_DATABASE
      volumes:
        - mysql:/var/lib/mysql
  
  volumes:
    wordpress: {}
    mysql: {}
  
  networks:
    default:
      external:
        name: wordpress
  </code></pre>
  <p>Looking forward to reading your suggestions</p>
  <p>Thank you</p>