Most useful Commands
- Command 1: build an image
The command:
docker build . -f path/to/Dockerfile -t talkohavy/repository:0.0.1 --no-cache
- Command 2: upload an image
The command:
docker build . -f path/to/Dockerfile -t talkohavy/repository:0.0.1 --no-cache
- Command 3: Just run an image locally
docker run -t --rm -e PORT=3000 IMAGE_ID
- Command 4: Run & SSH into image locally
docker run -it --rm -e PORT=3000 IMAGE_ID sh
- Command 5: Run an image & expose port to host
docker run -t --rm -p 8888:8888 imageName
- Command 6: Show logs of a running container
docker logs IMAGE_NAME_OR_ID
- Command 7: SSH into a running container
docker exec -it CONTAINER_NAME_ID sh
- Command 8: Copy a file into a container
When on your desktop, run the following:
docker cp ~/Desktop/my-file.txt CONTAINER_NAME_ID:/path/in/container/my-file.txt