Some useful docker command

Copy file/directory to Docker container
docker cp local_dir container_name:container_dir

Execute linux command to Docker container from host machine
docker exec -it container_name "linux-command-here"


Share host directory to Docker container
docker run -itd -v {host-folder-path}:{container-folder-path} --name {container-name} {image-name/id}

Create a new image from existing Docker container
docker commit {existing-container-name} {existing-image-name:new-image-tag}

Create a new container from an exiting image
docker run -itd --name {new-container-name} -p source-port:destination-port {image-name/id}

Share on Google Plus

About Md. Shahzad Alam

I am a passionate cloud and DevOps professional specializing in Linux and open-source solutions. Through this blog, I share my knowledge and experience with the community, offering tips and insights on cloud technologies and DevOps practices.
    Blogger Comment

0 comments:

Post a Comment