docker run container, how to rerun

I build container with:

docker build -f -t dave/xyz .

after that I run docker with:

  • AWS EC2 Docker Volumes lsblk
  • 'ERR_TOO_MANY_REDIRECTS' error nginx docker
  • My nodes Digital Ocean are UNREACHABLE from docker cloud
  • Django can't connect to Postgres in Docker setup
  • Kitematic Fail after clean setup
  • How to monitor user activity on docker
  • docker run -it \
    --env='LDAP_USER=uid=bot_for_git,ou=bots,dc=company,dc=org' \
    --env='LDAP_PASS=' --volume=/srv/docker/xyz/data1:/data \
    -p 8010:8010 -p 9989:9989 dave/xyz

    and verified that’s all ok.

    what is next?

    My guess, that I should run docker ps, take container id from there, and to run container with the same preferences (environment, port mapping, volumes mapping) I should run:

    docker start -a container_id

    am I right?

    And what about rebuilding image, if change and rebuild dave/xyz, does container with container_id get
    update automatically, or I should repeat docker run -it step?

  • Error when trying to run a meteor app in docker using meteorhacks:meteord
  • Docker image build as AWS CodePipeline step
  • Pod cannot get IP in PodCIDR, get the docker ip
  • Allow more memory when docker build a Dockerfile
  • Deploying multiple Deis clusters
  • How to connect a service running inside a docker with consul?
  • One Solution collect form web for “docker run container, how to rerun”

    docker build [...] creates an image. You can see your images with docker images. You may give that image a specific name with the --tag=[...] option:

        docker build --tag="superuser/bestimage:latest" .

    docker run [...] <imageId> takes that image and starts a container. You can see active containers with docker ps (all with docker ps -a). If you used the tag above, docker run -it superuser/bestimage:latest may be used.

    When you rebuild an image, a new image with a new id is created. You may see that through docker images.

    does container with container_id get update automatically

    No. In order to update your container, you must first remove the container with docker kill <id> and then start a new one with docker run -it <newID>.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.