February 2019
Intermediate to advanced
240 pages
5h 25m
English
When we ran our Rails server with this command:
| | $ docker run -p 3000:3000 a1df0eddba18 \ |
| | bin/rails s -b 0.0.0.0 |
we referred to our custom image by its ID: a1df0eddba18 (yours will differ). There’s no way we’re going to remember that. Just like you wouldn’t refer to a Git branch using the SHA-1 hash of its latest commit, the same is true for images. Instead, we give our images human-friendly names by tagging them. Let’s say we want to name our image railsapp. We can do this by running:
| | $ docker tag a1df0eddba18 railsapp |
which says, “Tag the image identified by ‘a1df0eddba18’ with ‘railsapp’.” To verify this worked, let’s list our images with:
| | $ docker ... |
Read now
Unlock full access