Dockerfile
to create a Docker container image for Akaunting.
Akaunting is a self-hosted open source accounting software.
If you find this image useful here's how you can help:
Before reporting your issue please try updating Docker to the latest version and check if it resolves the issue. Refer to the Docker installation guide for instructions.
SELinux users should try disabling SELinux using the command setenforce 0
to see if it resolves the issue.
If the above recommendations do not help then report your issue along with the following information:
docker version
and docker info
commandsdocker run
command or docker-compose.yml
used to start the image. Mask out the sensitive bits.Automated builds of the image are available on Dockerhub and is the recommended method of installation.
Note: Builds are also available on Quay.io
docker pull sameersbn/akaunting:1.3.9
Alternatively you can build the image yourself.
docker build -t sameersbn/akaunting github.com/sameersbn/docker-akaunting
The quickest way to start using this image is with docker-compose.
wget https://raw.githubusercontent.com/sameersbn/docker-akaunting/master/docker-compose.yml
Update the AKAUNTING_URL
environment variable in the docker-compose.yml
file with the url from which Akaunting will be externally accessible.
docker-compose up
Alternatively, you can start Akaunting manually using the Docker command line.
Step 1. Launch a MySQL container
docker run --name akaunting-mysql -itd --restart=always \
--env 'DB_NAME=akaunting_db' \
--env 'DB_USER=akaunting' --env 'DB_PASS=password' \
--volume /srv/docker/akaunting/mysql:/var/lib/mysql \
sameersbn/mysql:5.7.24
Step 2. Launch the Akaunting php-fpm container
docker run --name akaunting -itd --restart=always \
--env AKAUNTING_URL=http://akaunting.example.com:10080 \
--link akaunting-mysql:mysql \
--volume /srv/docker/akaunting/akaunting:/var/lib/akaunting \
sameersbn/akaunting:1.3.9 app:akaunting
Step 3. Launch a NGINX frontend container
docker run --name akaunting-nginx -itd --restart=always \
--link akaunting:php-fpm \
--publish 10080:80 \
sameersbn/akaunting:1.3.9 app:nginx
Point your browser to http://akaunting.example.com:10080
and login using the default username and password:
Note
Use the
AKAUNTING_ADMIN_EMAIL
andAKAUNTING_ADMIN_PASSWORD
variables to create a custom admin user and password on the firstrun instead of the default credentials.
For Akaunting to preserve its state across container shutdown and startup you should mount a volume at /var/lib/akaunting
.
The Quickstart command already mounts a volume for persistence.
SELinux users should update the security context of the host mountpoint so that it plays nicely with Docker:
mkdir -p /srv/docker/akaunting
chcon -Rt svirt_sandbox_file_t /srv/docker/akaunting
The image allows users to create backups of the Akaunting installation using the app:backup:create
command or the akaunting-backup-create
helper script. The generated backup consists of configuration files, uploaded files and the sql database.
Before generating a backup — stop and remove the running instance.
docker stop akaunting && docker rm akaunting
Relaunch the container with the app:backup:create
argument.
docker run --name akaunting -it --rm [OPTIONS] \
sameersbn/akaunting:1.3.9 app:backup:create
The backup will be created in the backups/
folder of the Persistent volume. You can change the location using the AKAUNTING_BACKUPS_DIR
configuration parameter.
NOTE
Backups can also be generated on a running instance using:
docker exec -it akaunting akaunting-backup-create
By default backups are held indefinitely. Using the AKAUNTING_BACKUPS_EXPIRY
parameter you can configure how long (in seconds) you wish to keep the backups. For example, setting AKAUNTING_BACKUPS_EXPIRY=604800
will remove backups that are older than 7 days. Old backups are only removed when creating a new backup, never automatically.
Backups created using instructions from the Creating backups section can be restored using the app:backup:restore
argument.
Before restoring a backup — stop and remove the running instance.
docker stop akaunting && docker rm akaunting
Relaunch the container with the app:backup:restore
argument. Ensure you launch the container in the interactive mode -it
.
docker run --name akaunting -it --rm [OPTIONS] \
sameersbn/akaunting:1.3.9 app:backup:restore
A list of existing backups will be displayed. Select a backup you wish to restore.
To avoid this interaction you can specify the backup filename using the BACKUP
argument to app:backup:restore
, eg.
docker run --name akaunting -it --rm [OPTIONS] \
sameersbn/akaunting:1.3.9 app:backup:restore BACKUP=1417624827_akaunting_backup.tar
To upgrade to newer releases:
Download the updated Docker image:
docker pull sameersbn/akaunting:1.3.9
Stop the currently running image:
docker stop akaunting
Remove the stopped container
docker rm -v akaunting
Start the updated image
docker run -name akaunting -itd \
[OPTIONS] \
sameersbn/akaunting:1.3.9
For debugging and maintenance purposes you may want access the containers shell. If you are using Docker version 1.3.0
or higher you can access a running containers shell by starting bash
using docker exec
:
docker exec -it akaunting bash