2023-10-02 12:47:40 +02:00
# Apktool in Docker
We provide an easy way to leverage `apktool` , along with common Android tools such as `zipalign` and `apksigner` , all from within Docker.
## Building the Docker image
2023-10-21 14:57:57 +02:00
To use the image, pull the pre-built image or build one from the repo root with the included Dockerfile:
2023-10-02 12:47:40 +02:00
```bash
2023-10-03 12:22:31 +02:00
docker pull ghcr.io/ibotpeaches/apktool:latest
# OR
2023-10-21 14:57:57 +02:00
docker build -t apktool:local -f docker/Dockerfile .
2023-10-02 12:47:40 +02:00
```
## Using the Docker image
2023-10-03 12:22:31 +02:00
The best way to use the image is to create aliases to run the internal commands. Replace `ghcr.io/ibotpeaches/apktool:latest` with `apktool:local` if you have built the image locally.
2023-10-02 12:47:40 +02:00
```bash
2023-10-03 12:22:31 +02:00
alias apktool="docker run --rm -ti --name=apktool -v \"${PWD}:${PWD}\" -w \"${PWD}\" ghcr.io/ibotpeaches/apktool:latest apktool"
alias zipalign="docker run --rm -ti --name=zipalign -v \"${PWD}:${PWD}\" -w \"${PWD}\" ghcr.io/ibotpeaches/apktool:latest zipalign"
alias apksigner="docker run --rm -ti --name=apksigner -v \"${PWD}:${PWD}\" -w \"${PWD}\" ghcr.io/ibotpeaches/apktool:latest apksigner"
2023-10-02 12:47:40 +02:00
```
## Running the commands
You can then utilize these commands as you would if they were natively installed:
```bash
apktool d My.apk -o MyFolder
apktool b MyFolder -o MyNew.apk
zipalign -p -f 4 MyNew.apk MyNewAligned.apk
apksigner sign --ks My.keystore MyNewAligned.apk
2023-10-05 02:14:56 +02:00
```