description |
---|
Deploying a docker image from the hub |
Some docker useful commands reference.
Examples assume there is an image at the following docker hub address https://hub.docker.com/repository/docker/cleberjamaral/jacamo-rest-run
- Building and assigning the tag
user/image_id
to the local image$ sudo docker build -t user/image_id .
- Check existing images
$ sudo docker images
- Create a network
$ sudo docker network create network_name
- Run a docker image
$ sudo docker run -ti user/image_id a_command
- Example
$ docker run -d -P -p 8888:8080 -ti cleberjamaral/jacamo-rest-run sh
- Example
- Pulling an image from docker hub
$ sudo docker pull user/image_id:tag
- Example
$ docker pull cleberjamaral/jacamo-rest-run:latest
- Example
- Running an instance and opening the terminal
$ docker run -ti repository_id sh
- Example
$ docker run -ti cleberjamaral/jacamo-rest-run sh
- Example
- Attaching to a running container
$ docker attach container_id
- Removing an image
$ sudo docker image rm image_id
- To force removing associated container
$ sudo docker image rm image_id -f
- To force removing associated container