mddanishyusuf / dailyhack

🐱‍💻 Tiny Tiny Hacks we use in our daily life.
https://dailyhack.now.sh/
149 stars 15 forks source link

Docker Basic Commands #88

Open absyah opened 5 years ago

absyah commented 5 years ago

These docker commands are that I use every single day

# show containers
docker ps

# Logging to container
docker logs -f <container_id>

# ssh to container
docker exec -it <container_id> /bin/bash

# build container
docker-compose build [container_name_on_yml]

# run container
docker-compose up [container_name_on_yml]

# run rails console on container
docker-compose run <container_name_on_yml> rails c

# remove all images
docker rmi -f $(docker images -a -q)

Please let me know your other docker's daily hacks! 🥇

mddanishyusuf commented 5 years ago

I know one trick to remove all images.

docker rmi -f $(docker images -a -q)

absyah commented 5 years ago

I added your hack accordingly. Thanks @mddanishyusuf !