How to address poor file share performance in Docker
February 13, 2020Docker is primarily designed for Linux. Thanks to its extensibility and openness, it has made its way to Windows and Mac OS X. On these operating systems, however, Docker has a speed issue when it comes to file access. How to solve it? How to improve performance?
                
            
Docker is a tool for streamlining work and solving some problems.
But it also introduces new problems.
However, a lot of the problems are brought about by ignorance of the tool, misuse of the tool, and ignorance of the Linux world.
Other platforms
I'll leave aside the problem of not knowing how to configure a Linux server and the associated (in)proper functioning and security.
Without Linux expertise, no one should deploy Docker in a production environment.
The most common problem Windows and macOS users have with Docker is the performance of file sharing between host and container.
Docker is primarily developed for Linux, so Windows or Mas OS X is not the right platform for people using Docker.
Some users have chosen the simple and optimal solution of switching from Windows or macOS to GNU/Linux. After all, Linux is the standard for developers because it is the ideal solution for them.
However, the user is not always willing to change. How to address the performance of file shares?
Other Tools
There are other tools that make development more efficient. So one option is to change these tools.
VirtualBox
For example, it is possible to use a full virtualization tool.
And install Linux and development tools in the virtual machine.
An ideal tool might be VirtualBox,
which is multiplatform so you can run it not only on Linux, but also on Windows and macOS
However, Docker does provide some automation of installation and configuration. There are standardized tools for this as well. For example, I manage Linux servers. I use Ansible, another option is Puppet and others.
Vagrant
You can use Vagrant, which is specifically designed to provide a development environment. Vagrant is a tool that will prepare your system in a virtual machine. It can just use VirtualBox or other lazy virtualization or even container virtualization as virtualization.
Docker file sharing optimization
But suppose you want to stay with Docker and not add any more ichnology. How to solve slow performance of file shares?
Limited Sharing
A very simple solution is not to link the whole project to Docker, but just the directory with the source code you need to edit. Keep the libraries and scripts and data that are processed in the container.
Virtual Machine + Sharing
Run Linux on a virtual machine and install Docker in it. You can then use a standard tool such as SAMBy (disk sharing) to share data out of the virtual machine. Or mount a shared directory from your machine to the virtual machine.
Docker other sharing
I don't think anyone wants to install a fully virtualized machine with Linux on it and deal with Docker. There would still be the option of running SAMBu or other sharing in Docker. This is also possible, you can run SAMBU in the same Docker container - but this is not the correct approach for Docker. However, you can run SAMBA in a separate container and share project data between containers and use SAMBA to share the data with your PC. (See the Docker and Cron article for how to run the application in a different container.)
A similar solution would be to use sshfs, ftps, nfs or other.
Data Sync
Another solution is to not have the source code of the container application over volume, but automatically sync the data. For example, Phpstorm can sync data over SSH to the container when any change is made. It can also detect external changes, so there is no need to rebuild the whole container when composer update/install. It's fast and works reliably and consistently on all platforms.
Training
For companies that want to streamline their operations, I can recommend Docker to them. And by way of Docker training and subsequent collaboration together, we'll bring Docker into the business.
Interesting resources
Articles on a similar topic
        
            SAP HANA database
                            
            
        
            Command AT
                            
            
        
            Docker build multiarch image
                            
            
        
            VMware vs Proxmox: performance comparison
                            
            
        
            GitLab CI/CD: test automation and application deployment
                            
            
        
            Migrating VPS from VMware to Proxmox
                            
            
        
            VMware licensing change
                            
            
        
            Running Microsoft SQL Server on Linux
                            
            
        
            Backup: the Proxmox Backup Server
                            
            
        
            Linux as a router and firewall
                            
            
        
            How to upload a docker image to the Docker Registry
                            
            
        
            Linux: logical volume management
                            
            
        
            Linux Software RAID
                            
            
        
            Running a web application behind a proxy
                            
            
        
            Mailbox migration
                            
            
        
            Docker multistage build
                            
            
        
            Backing up your data by turning on your computer
                            
            
        
            Podman
                            
            
        
            Importing Windows into Proxmox virtualization
                            
            
        
            Docker and PHP mail
                            
            
        
            Proxmox virtualization
                            
            
        
            Docker and Cron
                            
            
        
            Lenovo ThinkPad X1 Carbon: LTE modem EM7544 commissioning
                            
            
        
            Yocto Project: Build custom operating system for embedded devices
                            
            
        
            Preparing a Linux server to run a web application in Python
                            
            
        
            How to get started using Docker correctly
                            
            
        
            Installing Linux on a dedicated HPE ProLiant DL320e server
                            
            
        
            How to stress test a web application
                            
            
        
            Why use the JFS filesystem
                            
            
        
            How to boot from a 4TB drive with GTP using UEFI
                            
            
        
            Btrfs file system
                            
            
        
            Raspberry PI
                            
            
        
            WINE - running Windous programs under Linux
                            
            
        
            GNU/Linux operating system
                            
            
            
Newsletter
    If you are interested in receiving occasional news by email.
    
    You can register by filling in your email 
        news subscription.
+