DevOps, Data Engineering
4 Docker Options You May Not Know
How to remove an image in Docker, rebuild an image from the base image, pass some configuration files to a Docker container, and run linux/amd64 images on linux/arm64 architecture.
In this short article, I take note of the following useful commands in Docker that I have discovered recently:
- Removing an image in Docker
- Rebuilding an image from the base image
- Passing some configuration files to a Docker container
- Attaching a terminal to a Docker container
Removing an image in Docker
You can remove a Docker image directly from Docker Desktop. However, sometimes, the image is running so you cannot remove that. Don’t worry! You can remove the image directly from the terminal as follows:
docker rmi -f <image_id>You can take the image id from the Docker Desktop interface.
You can find more details in the Docker official documentation:
Rebuilding an image from the base image
If you want to rebuild an image from the base image, you should use the --no-cache option as follows:
docker build -t my_image .
You can find more details here:
Passing some configuration files to a Docker container
There are different ways to pass configuration files to a Docker container. Here, I suggest one possible solution, based on Docker Volumes, which permits you to map any directory in your file system to a directory in the Docker container:
docker run -v <source path>:<dest path>You can find more details in the following article:
Attaching a terminal to a Docker container
If you want to run some command within a Docker container, you can run the following command:
docker exec -it <container_name> /bin/shThe container must be running.
Running linux/amd64 images on linux/arm64 architecture
You can read this interesting thread on Reddit:





