4 ms·
Basic Docker Commands for Beginners
- team-o 6y agoI personally find the interactive switch very useful to actually control the container. You can use "-it" flag for this. docker run -it [IMAGE_NAME] [ENTRYPOINT] e.g. docker run -it ubuntu:xenial /bin/bash
- fauria 6y agoI would recommend adding "--rm", to avoid leaving leftovers when the container exits: https://docs.docker.com/engine/reference/run/#clean-up---rm https://docs.docker.com/engine/reference/run/#clean-up---rm
- globular-toast 6y agoThe problem with these kind of Docker "recipe books" is users very quickly build up an unmanageable number of containers, images, networks, volumes etc. on their Docker hosts. When these users inevitably run into unexpected behaviour (or run out of disk space) their only solution is to "destroy the world" with some other recipe like a "docker prune". I see similar things with git users who only learn recipes. I die a little inside every time I see someone fix their problems by deleting and recloning the repo because that's what it says to do on "ohshitgit.com".
- stevekemp 6y agoYeah this is really low-effort spam, there's no reasoning, no explanation, nothing here will help somebody understand how to use Docker properly. It's a shame, but this kind of SEO obviously works.
- BiteCode_dev 6y agoOk, so the dev who knows 5 languages, a bit about database, git and sysadmin has been hired to do one job. On this job, one must learn the entire stack, including docker, in a few months, while still reaching the deadline. The dev won't be paid more. The company won't spend more resources. Time is short, talent scarce, customers in a hurry. What do you think will happen? This is the software industry in a nutshell.
- a_imho 6y agoBacktracking to a known working state is a legit troubleshooting strategy. Have you tried turning it off and on again?
- AzzieElbab 6y agoI think you are confusing dev and prod. Who cares how I got local kafka running?
- qppo 6y agoYour coworker who doesn't know what the fuck Kafka is or why you need it to get the system online.
- AzzieElbab 6y agoassuming my coworker is burrowing my laptop? I will reiterate, docker is amazing for setting up and tearing down complex software locally for dev. Productialization is a whole different story. For example, in case of kafka or kdb or scylla I would not even run them in docker to begin with.
- pibefision 6y agoI prefer Docker Compose to script all my docker tasks. It's easy, requires some understanding first (ie: environment variables) but after that you have reusable recipes.
- Traster 6y agoAbsolutely, one of the things I find very frustrating about Docker is that for the situations I need it it's never sufficient in itself, you still need to be mapping ports and volumes and setting variables- and that's all done in terminal commands which I have to remember or store somewhere and if I get something wrong it all falls apart. With docker-compose I've actually got a single file that I an use to make sure the container actually is reproducible. I'm willing to accept that maybe I just have weird requirements though.
- cmehdy 6y agoI'm definitely not arguing about the advantages that docker-compose can bring (for me: readability & multiple containers easily connected), but aren't port mapping (-p) and env. variables (-e) and volumes (-v) simple with a docker command? See https://docs.docker.com/engine/reference/commandline/run/ https://docs.docker.com/engine/reference/commandline/run/
- Traster 6y agoThey're simple, but what I want is a file I can point to and say "This is how we do things", to me that's a large part of what docker-compose brings.
- markl42 6y agoShameless plug time! I made https://composerize.com/ https://composerize.com/ for exactly this - converting all the docker run commands from tutorials and such into reusable compose files :)
- kovacs_ 6y ago
- wicket 6y ago> If you’re trying to learn Docker you will first have to master its various terminal commands. This is completely the wrong way to go about learning Docker. The biggest problem with Docker is that there are too many people using it who claim they know Docker because they learnt a few commands they read on the internet, but they don't actually understand what a container is. In reality, this leads to all sorts of problems, like the deployment of insecure containers in the wild. Guides like this are recipe for disaster.
- sosilkj 6y agoAny recommendations for better learning resources?
- wicket 6y agoWhen I picked up Docker, I had already been using other container technologies for several years so I personally don't know of any modern or complete learning resources that I can recommend. However I would recommend starting out by understanding what namespaces are, i.e. how container isolation works. You should also be aware of what cgroups are and how they are used, but you won't need profound knowledge of them when starting out. The man pages [1] [2] might be a good place to start. [1] http://man7.org/linux/man-pages/man7/namespaces.7.html http://man7.org/linux/man-pages/man7/namespaces.7.html [2] http://man7.org/linux/man-pages/man7/cgroups.7.html http://man7.org/linux/man-pages/man7/cgroups.7.html
- gspr 6y agoSomewhat related to this: although I like to imagine I'm still young (hah!), dynamic and open, I'm quite set in my ways and conservative with software (Debian is my distro of choice on any computer). There's two particular areas where I've tried to learn newfangled stuff over the past few years: deep learning frameworks (because I find the field interesting) and Docker (because it does seem very practical in some circumstances). I feel exhausted by how hard it can be to find good information on either one! Everything I need is usually out there, but it's buried in pages upon pages of google hits that are short recipes or "tutorials" that involve sequencing a bunch of runes without communicating any understanding of what's going on. Does anyone have a good strategy when approaching such hyped up topics (not in particular the aforementioned ones) where almost all sources seem to focus on "just getting it working" and lowering the barrier to entry? I don't mean to promote gatekeeping here, it's just that I personally can't learn from the "just do this then this" style.