You're right to be puzzled! The command you used is attempting to create a compressed archive of your entire root filesystem (/*) and exclude several common temporary and system directories. However, it's likely not working as expected because of how Docker handles the filesystem and the permissions involved.
Here's a breakdown of why your command isn't showing any signs of activity on /tmp and what's happening:
Why it's likely not working on /tmp:
- Docker's Isolated Filesystem: Docker containers operate with a layered filesystem. The
/tmp directory within a container is often a separate, ephemeral volume that isn't directly accessible or easily tarred from the host machine.
- Permissions: The
tar command is likely encountering permission issues when trying to traverse and archive the root filesystem of a running Docker container. You're trying to run this command on the host machine while the container is running. The host's permissions won't automatically grant access to the container's internal filesystem.
- Mount Points: Docker mounts various directories from the host into the container. While you're excluding some common host directories, the
/tmp directory inside the container might be managed differently.
- Read-Only Filesystem (Potentially): Depending on the Docker setup and the container's configuration, the root filesystem might be mounted as read-only, preventing
tar from creating an archive.
What's actually happening when you run this command on the host:
Your command is attempting to:
tar czf /tmp/malix.tgz: Create a gzipped tar archive named malix.tgz in the /tmp directory of the host machine.
-X /dev/* -X /proc/* -X /sys/* -X /tmp/*: Exclude all directories and files within /dev, /proc, /sys, and /tmp from the archive.
/*: Include all files and directories within the root filesystem of the host machine.
Since you're running this on the host, it's archiving the host's filesystem, not the filesystem inside the running Docker container. Therefore, you won't see any changes or signs of activity on the container's /tmp directory.
How to get the contents of a Docker container's /tmp directory:
To access the contents of a Docker container's /tmp directory, you need to:
- Stop the container:
docker stop <container_id>
- Create a temporary container:
docker run --rm -it <image_name> /bin/bash (This creates a new container for exploration)
- Mount the container's
/tmp directory to your host: docker cp <container_id>:/tmp /tmp/host_tmp
- Copy the contents from the mounted directory:
ls /tmp/host_tmp or tar -tvf /tmp/host_tmp/malix.tgz (if you had already created an archive)
- Remove the temporary container and mounted directory:
docker rm <container_id> and rm -rf /tmp/host_tmp
In summary, your command is archiving the host machine's filesystem, not the contents of the running Docker container. To access the container's /tmp, you need to use docker cp or other container inspection tools.
Let me know if you have any other questions or if you're trying to achieve a specific goal with this command!