The title says it all really. I just want to find out whether I need to know web code to be a good graphic designer.
A graphic designer creates graphics.
A web designer builds web sites.
They aren't the same job. It's very cool if a web designer can create his own graphics, or a graphic designer can prototype web pages, but in my experience of working in organisations, the 'graphics department' and the 'web team' are usually different teams with different skill sets. I'm sure there are individual freelancers who combine both skills, but most web designers I've met are NOT Photoshop experts, and most graphic designers don't know Bootstrap and jQuery.
As @joojaa says in the comments, it doesn't hurt if someone can do both. But it's not usually a necessity.
Define "web code".
That can mean a whole lot of things.
Do you need to be a great coder to be a great graphic designer? No. Of course not.
Does having a good understanding of front end presentation layer code make you a better web/UI designer? Absolutely.
As with any medium, the more you understand the medium and the tools used within it, the more you can bend it to your desires.
If you're going to be designing graphics intended for web use it would be good to understand what makes your work user friendly to the web developer that needs to use it, but beyond that, NO!!!... There's a quirk to being an Artist where a lot of people look at us as the "grunts" of the workplace simply because they underestimate the value of our trade. When you encounter people like that RUUUUUN!!!!... idk how many fellow Artists and Designers I've known who worked for a place who used them as a secretary, janitor and errand boy/girl. The whole place could be slow and EVERYBODY could be standing around chit chatting watching youtube, but it's the Artists who have to go clean toilets and wipe sinks for the sake of being useful and earning their keep.
With that being said, a lot of times when you see job ads asking for an Artist who knows alllllll these other professions, that's usually the frame of mind they're thinking from and it sucks because they pass it off as something realistic when it's really not.
It does not hurt. Knowing how to do X is not really a part of design. Designing means that you put thought behind your task, plan it, and make sure the plan is executable. So for great designers it wold be enough to communicate the idea to others. Note not really talking of graphic design just design in general.
Now for practical purposes the designer usually needs to make at least a mock-up of what he is designing. Partly because its hard to know how things will come out, without doing so. Partly because its not possible to ensure that the design works otherwise, thus is not executable. In reality nobody is going to pay for a design that can not be shown to work.
Graphic designers also are understandably required to be able to do the graphic part of the story. Usually that means to put together a layout, choose typography colors and arrange them in a somewhat final digital form. It does not necessitate the skills of an illustrator for example but that too can help. Anyway one problem is to find somebody willing to pay for your work.
As a result it is extremely valuable to know how to do things. As ultimately it makes for better designs. So at minimum you should be able to pick up a skill or two on nearly anything. The more you know the better, sometimes that means being able to pick up a new skill faster.
PS: It is also not possible to jump directly to late career greatness. The world will change before you get there. So be prepared to change with it.