Software licensing in container images

I apologize if this answer is spelled out clearly somewhere, but I find the whole issue somewhat vague and confusing so I was hoping someone could answer a question for me:

Let’s say I write some code and decide to release it under the MIT license. If I then install my code on an Ubuntu base image (for example) along with a few 3rd party prerequisite libraries, and create a new docker image from it, can I distribute that without violating any of the stricter licenses of the software included in the image? If not, how do I work around this?

To be explicit, I’m not modifying anyone else’s code, just including it in an image along with my code.

Thanks!